Sorting Retrieved Data Flashcards
1
Q
ORDER BY
A
(basically ascending – A to Z)-
SELECT prod_name
FROM Products
ORDER BY prod_name;
2
Q
ORDER BY 2 or more columns
A
SELECT prod_id, prod_price, prod_name
FROM Products
ORDER BY 2, 3;
3
Q
ORDER BY DESC (Z to A)
A
SELECT prod_name
FROM Products
ORDER BY prod_name DESC;
to apply DESC sorting to different column you must write DESC for every COLUMN
4
Q
ORDER BY multiple columns
A
SELECT prod_id, prod_price, prod_name
FROM Products
ORDER BY prod_price DESC, prod_name;