SQLTeam.com | Weblogs | Forums

[SQL] What is the difference?

What's the difference between these three SQL statements below? ( compare them in any aspects you can think of)
Select CustomerName, ProductName from Customers, Orders, OrderDetails, Products
vs
Select CustomerName, ProductName from Customers, Products, Orders, OrderDetails
vs
Select CustomerName, ProductName from Customers, Products

this sounds alot like homework. Maybe you should post what you think and we can comment

for me, the first 2 queries should function the same. I'm not sure about the difference between 1,2 and 3

there are no joins between the tables, so how do you join them? ColumnNames could be in multiple tables, probably not in this case, but if they were, you'd get an ambiguous column error. There is no where clause so you'd be returning a cartesian product of all tables. Syntax is deprecated.

The first 2 queries are functionally equivalent.

The 3rd query may list fewer rows, the same number of rows or more rows than the first 2 queries.