When writing SQL queries there will be times, for any reason, you’d rather call a column by a different name. You can easily rename a column (or table, introduced in a future video and blog post) using an alias. An alias is a temporary name and is only active during the span of the query.
The alias is always written directly after the column name using the AS command. Include the alias in single quotes:
Name AS ‘Computer Name’,
TIP: The last column in a SELECT statement never has any punctuation after it. Notice how all other columns are separated by commas. If you accidentally leave a comma after the last column of your SELECT statement, you will receive a syntax error. In PDQ Inventory, the syntax error looks something like:
Expanding the error description by clicking the blue question mark symbol will show you a more detailed visual:
The description states the error is ‘near "FROM". This is because the FROM statement is directly after the syntax error.
Check out a live video here.