Which type of join is demonstrated by the following query?
sql
SELECT *
FROM Make, Model
WHERE Make.ModelID = Model.ID;
This query performs a join operation where records from the Make table and Model table are combined based on the condition Make.ModelID = Model.ID. This condition tests for equality, which is the definition of an EQUIJOIN.
Types of Joins in SQL:
EQUIJOIN (Correct Answer):
Uses an equality operator (=) to match rows between tables.
Equivalent to an INNER JOIN ON condition.
Example:
sql
SELECT *
FROM Employees
JOIN Departments ON Employees.DeptID = Departments.ID;
NON-EQUIJOIN (Incorrect):
Uses comparison operators other than = (e.g., <, >, BETWEEN).
Example:
sql
SELECT *
FROM Employees e
JOIN Salaries s ON e.Salary > s.MedianSalary;
SELF JOIN (Incorrect):
A table is joined with itself using table aliases.
Example:
sql
SELECT e1.Name, e2.Name AS Manager
FROM Employees e1
JOIN Employees e2 ON e1.ManagerID = e2.ID;
CROSS JOIN (Incorrect):
Produces Cartesian product (each row from Table A combines with every row from Table B).
Example:
sql
SELECT *
FROM Employees
CROSS JOIN Departments;
Thus, since our given query uses an equality condition (=) to join two tables, it is an EQUIJOIN.
Rodolfo
3 days agoCecilia
8 days agoMajor
13 days agoMatt
18 days agoLetha
24 days agoParis
29 days agoVernice
1 month agoReynalda
1 month agoGarry
1 month agoJerry
2 months agoEric
2 months agoSkye
2 months ago