Using AS

You can also save yourself some typing and improve query readability by creating aliases using the AS keyword. Simply follow a table name with AS and the alias to use.

SELECT name,author,title from
customers AS cust, classics AS class WHERE cust.isbn=class.isbn;

You can also use AS to rename a column (whether or not joining tables), like this:

SELECT name AS customer FROM customers ORDER BY customer;

Aliases can be particularly useful when you have long queries that reference the same table names many times 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *