Beyond better readability, there is another case where explicitly joined tables are better than comma-separated tables.
see example:
Create Table table1 ( ID int NOT NULL Identity(1, 1) PRIMARY KEY , Name varchar(50) ) Create Table table2 ( ID int NOT NULL Identity(1, 1) PRIMARY KEY , ID_Table1 INT NOT NULL )
The following query will give me all the columns and rows from both tables
SELECT * FROM table1, table2
The following query will give me columns from the first table with a table alias called "table2"
SELECT * FROM table1 table2
If you mistakenly forget a comma in a compound separated by commas, the second table will automatically convert to a table alias for the first table. Not in all cases, but there is a chance of something like this.
veljasije Nov 25 '13 at 14:28 2013-11-25 14:28
source share