Aliases allow you to type fewer characters by replacing the long name of a table with a shorter name (often a single character. Line 8 shows a JOIN statement without aliases. Line1 shows a JOIN statement with aliases where the 'Customer2' table is replaced with an alias of 'a' and the 'Orders2' table is replaced with an alias 'b'. The alias is defined by placing the alias after the table name in the FROM and JOIN sections (lines 3 and 4). The naming of the alias can occur in the statement after the alias is first used (below, the alias is first used in line 2, but the aliases aren't identified until lines 3 and 4). Line 15 shows an alternate way to identify an alias using AS.
-- WITH ALIASES
SELECT a.CustomerID, a.LastName, b.OrderID, b.Price
FROM Customers2 a
JOIN Orders2 b
WHERE a.CustomerID = b.CustomerID;
-- WITHOUT ALIASES
SELECT Customers2.CustomerID, Customers2.LastName, Orders2.OrderID, Orders2.Price
FROM Customers2
JOIN Orders2
WHERE Customers2.CustomerID = Orders2.CustomerID;
-- ALTERNATE EXAMPLE WITH ALIASES
SELECT o.OrderID, o.OrderDate, c.CustomerName
FROM Customers AS c, Orders AS o
WHERE c.CustomerName = "Around the Horn" AND c.CustomerID=o.CustomerID;