ASC
ASC stands for ascending. It is an optional keyword used in the ORDER BY clause to sort data in ascending order. The default order is ascending, so its usage is often omitted.
Example
Output
Explanation
In the SQL code above, SELECT * FROM Employees
is used to retrieve all records from the Employees
table. The ORDER BY LastName ASC
clause is used to sort the records in ascending order based on the LastName
column. The resulting output contains all employee records, organized in an ascending order with respect to the last names.
Example
Output
Explanation
The given SQL statement fetches all records from the employees
table and orders them by the last_name
column in ascending (ASC) order.
Example
Output
Explanation
The SQL statement selects all records from the Employees
table and orders them in ascending order (ASC
) by the LastName
column. The output displays EmployeeID, LastName, FirstName and Title of all employees, sorted by LastName in alphabetical order A-Z (as arranged by ASCII values).
Example
Output
Explanation
The SQL code selects all columns from the ‘Employees’ table and orders the resulting records in ascending order by the ‘Salary’ column. In the output, the Employee records are ordered from the lowest to the highest salary.
Example
Output
Explanation
The SQL code provided above selects all records from the “Employees” table and then sorts the output in ascending (ASC) order based on the “Last_Name” column. This means that the records are displayed alphabetically from A-Z based on the last names of the employees.