sql order by multiple columns

Solutions on MaxInterview for sql order by multiple columns by the best coders in the world

showing results for - "sql order by multiple columns"
Katlyn
05 Jan 2020
1SELECT * FROM People ORDER BY FirstName DESC, YearOfBirth ASC
2
Lucia
06 Jan 2021
1The following shows that you can perform order by with more
2than one column.
3'ASC' denotes ascending sort order, but is optional as it is the default sort order.
4'DESC' denotes descending sort order
5
6SELECT Id, CompanyName, City, Country  
7FROM Supplier 
8WHERE Country IN ('USA', 'Japan', 'Germany') 
9ORDER BY Country ASC, CompanyName DESC
Yasmina
03 Oct 2018
1SELECT * FROM table_name ORDER BY col1 ASC;				-- ASCending is default
2SELECT * FROM table_name ORDER BY col1 DESC;			-- DESCending
3SELECT * FROM table_name ORDER BY col1 DESC, col2;		-- col1 DESC then col2 ASC
Jayson
01 Apr 2016
1Sort by multiple column : ORDER BY column1 DESC, column2
Violeta
02 Sep 2020
1ORDER BY column1 DESC, column2
2