All who answered before me are faithful. You use it as the name of the alias label for the table when you have long queries or queries that have joins. Here are some examples.
Example 1
SELECT P.ProductName, P.ProductGroup, P.ProductRetailPrice FROM Products AS P
Example 2
SELECT P.ProductName, P.ProductRetailPrice, O.Quantity FROM Products AS P LEFT OUTER JOIN Orders AS O ON O.ProductID = P.ProductID WHERE O.OrderID = 123456
Example 3 It is recommended to use the AS keyword and highly recommended, but you can run the same query without one (and often).
SELECT P.ProductName, P.ProductRetailPrice, O.Quantity FROM Products P LEFT OUTER JOIN Orders O ON O.ProductID = P.ProductID WHERE O.OrderID = 123456
As you can tell, I left the AS keyword in the last example. And it can be used as an alias.
Example 4
SELECT P.ProductName AS "Product", P.ProductRetailPrice AS "Retail Price", O.Quantity AS "Quantity Ordered" FROM Products P LEFT OUTER JOIN Orders O ON O.ProductID = P.ProductID WHERE O.OrderID = 123456
Conclusion of Example 4
Product Retail Price Quantity Ordered Blue Raspberry Gum $10 pk/$50 Case 2 Cases Twizzler $5 pk/$25 Case 10 Cases
XstreamINsanity Nov 12 2018-10-12 12:46
source share