AS keyword mandatory for table aliases? RRS feed

  • Question

  • In SQL statements can anyone point to some documentation or if you're an authority, can you say for sure that AS is NOT required for table aliases?

    I normally use MySQL and SQL Server.  It wasn't part of my project requirements to use aliasing.  Access adds in the AS keyword.  Only when we save it, though.  If you run the SQL query it runs fine and if you go back to edit it it doesn't have the AS; however, when you save, it changes the query.

    I did find the actual definition for Transact-SQL that says AS is optional, but Access is a bit different than Transact-SQL; right?  Is there a definition that someone can point to?  I also got someone to show me the definition for the ANSI standard and it also says AS is optional.

    So can anyone say for sure that the AS keyword is not required for aliasing table names in Access?  

    Here's one of the queries that I wrote:

    SELECT e.FirstName, e.LastName, e.Phone, t.TrainingDate, l.[Location Name], p.ProductName FROM ((training t INNER JOIN Employees e ON e.ID = t.EmpID) INNER JOIN Product p ON p.ProductID = t.ServiceID) INNER JOIN Location l ON l.ID = t.LocationID WHERE p.PerPersonTrainingCost < 100;

    • Edited by Blue Baron Monday, November 28, 2016 4:12 AM
    Sunday, November 27, 2016 6:38 PM


  • The AS keyword is optional in defining a table alias.  The fact that the query designer will put it in is not really relevant -- it puts in other elements that aren't required, too, and even in certain cases converts valid SQL to invalid SQL.

    The AS keyword *is* required when defining a field alias, but that's not the case you're talking about.

    Dirk Goldgar, MS Access MVP
    Access tips:

    • Marked as answer by Blue Baron Monday, November 28, 2016 4:06 AM
    Sunday, November 27, 2016 7:22 PM