SQL 강좌 7.SQL ORDER BY Keyword

The SQL ORDER BY Keyword

정렬과 관련된 구문, 어떤 순서로 가져올 것인지 결정함

SQL ORDER BY Syntax

SELECT column_name, column_name
FROM table_name
ORDER BY column_name, column_name ASC|DESC;

Default는 ASC임

ORDER BY Example

SELECT * FROM Customers
ORDER BY Country;

ORDER BY DESC Example

SELECT * FROM Customers
ORDER BY Country DESC;

ORDER BY Several Columns Example

SELECT * FROM Customers
ORDER BY Country, CustomerName;

ORDER BY Several Columns Example 2

SELECT * FROM Customers
ORDER BY Country ASC, CustomerName DESC;

Comments