In SQL Server Order By clause is used to sort records. the sort order is defaulted to ASC or ascending order. We can sort ASC or DESC in SQL server.
Example of sorting in Ascending
SELECT last_name
FROM tbl_EMP
WHERE employee_id > 500
ORDER BY last_name ASC;
Example of sorting in Descending
SELECT last_name
FROM tbl_EMP
WHERE name = 'STK'
ORDER BY last_name DESC;
No comments:
Post a Comment