Consider two tables: Employees and Departments.
Employees has columns: EmpID, Name, DeptID.
Departments has columns: DeptID, DeptName.
What rows will this query return?
SELECT Employees.Name, Departments.DeptName FROM Employees INNER JOIN Departments ON Employees.DeptID = Departments.DeptID;
INNER JOIN returns rows where the join condition matches in both tables.
Only employees with a matching DeptID in Departments appear. Charlie has no matching DeptID, so is excluded.
Choose the best description of what an INNER JOIN does.
Think about which rows appear when both tables have matching values.
INNER JOIN returns only rows where the join condition matches in both tables.
Identify the query that will run without syntax errors and perform an INNER JOIN between Orders and Customers on CustomerID.
Check the correct JOIN syntax and operator for equality in SQL.
Option D uses correct INNER JOIN syntax with ON and single equals sign for comparison.
Option D is missing ON clause.
Option D uses USING without parentheses, which is valid in some SQL dialects but not standard MySQL.
Option D uses double equals which is invalid in SQL.
You have two large tables joined by DeptID. Which option best improves INNER JOIN query speed?
Indexes help databases find matching rows faster.
Indexing the join columns speeds up matching rows in INNER JOIN.
Other options either slow down or produce incorrect results.
Given tables Students and Enrollments, this query returns no rows:
SELECT Students.Name, Enrollments.Course FROM Students INNER JOIN Enrollments ON Students.ID = Enrollments.StudentID;
What is the most likely reason?
Think about what INNER JOIN requires to return rows.
INNER JOIN returns rows only when join columns match. If no matches exist, result is empty.