To retrieve a record in multiple orders for different columns from the existing created table. Then we can use an ' ORDER BY ' Clause multiple times with ASC or DESC differently depending upon the requirement.
Suppose if we want to retrieve a record in ascending order of a first_name, And there are two or more records with the same first_name. So for the same first_name record, we want to retrieve its last_name in descending order.
Then we have to 1st declare first_name in ascending and 2nd declare last_name in descending.
In this 'ORDER BY first_name ASC, last_name DESC ' and 'ORDER BY last_name DESC, first_name ASC' both look the same, but both will retrieve different data
# | Program | Language |
---|---|---|
1 | SQL | |
2 | SQL | |
3 | SQL | |
4 | SQL | |
5 | SQL | |
6 | SQL | |
7 | SQL | |
8 | SQL | |
9 | SQL | |
10 | SQL | |
11 | SQL | |
12 | SQL | |
13 | SQL | |
14 | SQL | |
15 | SQL | |
16 | SQL | |
17 | SQL | |
18 | SQL | |
19 | SQL | |
20 | SQL | |
# | Program | Language |
Copyright © 2020 Inovatik - All rights reserved