Joins

suggest change

Explicit joins should always be used; implicit joins have several problems:

SELECT d.Name,
       e.Fname || e.LName AS EmpName
FROM      Departments AS d
LEFT JOIN Employees   AS e ON d.ID = e.DepartmentID;
SELECT RecipeID,
       Recipes.Name,
       COUNT(*) AS NumberOfIngredients
FROM      Recipes
LEFT JOIN Ingredients USING (RecipeID);

This requires that both tables use the same column name. USING removes the duplicate column from the result, so this join returns a single RecipeID column. USING is not accepted by SQL Server.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents