Page 166 - SQL
P. 166
Likewise, you can escape keywords in MSSQL with all different approaches:
SELECT
FName AS "SELECT",
MName AS 'FROM',
LName AS [WHERE]
FROM Employees
SELECT FROM WHERE
James John Smith
John James Johnson
Michael Marcus Williams
Also, a column alias may be used any of the final clauses of the same query, such as an ORDER BY:
SELECT
FName AS FirstName,
LName AS LastName
FROM
Employees
ORDER BY
LastName DESC
However, you may not use
SELECT
FName AS SELECT,
LName AS FROM
FROM
Employees
ORDER BY
LastName DESC
To create an alias from these reserved words (SELECT and FROM).
This will cause numerous errors on execution.
Selection with sorted Results
SELECT * FROM Employees ORDER BY LName
This statement will return all the columns from the table Employees.
Id FName LName PhoneNumber
2 John Johnson 2468101214
1 James Smith 1234567890
https://riptutorial.com/ 148

