 |
SQL Keywords: ASC
|
|
|
|
The ASC keyword is used to sort the records of a
query in
ascending order. The ASC keyword is used in conjunction with the ORDER
BY expression. The formula to follow is:
SELECT What FROM WhatObject ORDER BY WhatField;
The field used as the basis must be recognized as part
of the selected columns.
|
Here is an example
USE Exercise;
GO
SELECT EmployeeNumber,
FirstName,
LastName,
DateHired,
HourlySalary
FROM Employees
ORDER BY LastName ASC;
GO
If you use the * operator to include all fields, you
can order the list based on any of the table's fields.
|
|