CC SQL 5. sorting retrieved Data

Card Set Information

Author:
dau108
ID:
146220
Filename:
CC SQL 5. sorting retrieved Data
Updated:
2012-04-07 12:05:20
Tags:
CC SQL sorting retrieved Data
Folders:

Description:
CC SQL 5. sorting retrieved Data
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user dau108 on FreezingBlue Flashcards. What would you like to do?


  1. sorting data
    • SELECT prod_name
    • FROM products
    • ORDER BY prod_name;
  2. sorting by multiple columns
    • SELECT prod_id, prod_price, prod_name
    • FROM products
    • ORDER BY prod_price, prod_name;

    • It is important to understand that when you are sorting by multiple columns, the sort sequence is exactly as specified. In other words, using the output in the previous example, the products are sorted by the prod_name column only when multiple rows have the same prod_price value. If all the values in theprod_price column had been unique, no data would have been sorted byprod_name.
  3. specifying sort direction
    • SELECT prod_id, prod_price, prod_name
    • FROM products
    • ORDER BY prod_price DESC;

What would you like to do?

Home > Flashcards > Print Preview