CHAPTER 3
Joins
105
anSI SQL-89 Syntax
Similar to cross joins, inner joins can be expressed by using the ANSI SQL-89 syntax. You specify a
comma between the table names just as in a cross join, and specify the join condition in the query’s
WHERE clause, like this.
SELECT E.empid, E.firstname, E.lastname, O.orderid
FROM HR.Employees AS E, Sales.Orders AS O
WHERE E.empid = O.empid;
Note that the ANSI SQL-89 syntax has no ON clause.
Again, both syntaxes are standard, fully supported by SQL Server, and interpreted in the same way
by the engine, so you shouldn’t expect any performance difference between the two. But one syntax
is safer, as explained in the next section.
Do'stlaringiz bilan baham: |