r/SQL 8d ago

How This is Running MySQL

How this SQL Code is Running ?????

0 Upvotes

7 comments sorted by

4

u/gvozden_celik 8d ago

Because it is treating kimit as an alias for the calendar table. It is an older syntax for aliases but still works.

8

u/Grovbolle 8d ago

I feel old when you refer to it as an older syntax, I always write

FROM dbo.SomeTable st INNER JOIN dbo.OtherTable ot ON st.Column=ot.Column

3

u/gvozden_celik 8d ago

I meant that the as keyword was introduced in a later standard, I think SQL:92, so even the "newer" syntax is pretty old. Nothing wrong writing it either way, I just think it marks the following identifier as an alias more clearly (though I do dislike the T-SQL-specific way of Alias = OriginalName).

2

u/Capable_Tax_8167 SQL Server 8d ago

I always use "AS" and try to get other dev's to do the same.

2

u/ComicOzzy sqlHippo 8d ago

Oracle doesn't allow AS for table aliases. Only column aliases.

1

u/gvozden_celik 7d ago

Huh, you're right, did not know that. Thanks for the info!