Loading

Quipoin Menu

Learn • Practice • Grow

sql / SQL Self Join
mcq
Direction: Choose the correct option

Q1.

What is a self join?
A. Joining with system tables
B. Joining a table with itself
C. Joining three tables
D. Joining two different tables
Direction: Choose the correct option

Q2.

SELECT e.name AS employee, m.name AS manager FROM employees e LEFT JOIN employees m ON e.manager_id = m.emp_id;
What does this query find?
A. Company hierarchy
B. Employees and their managers
C. Managers only
D. Employees only
Direction: Choose the correct option

Q3.

SELECT e.name, e.salary, m.name, m.salary FROM employees e JOIN employees m ON e.manager_id = m.emp_id WHERE e.salary > m.salary;
What does this find?
A. All employees
B. Employees earning more than their managers
C. Managers earning more
D. Salary comparisons
Direction: Choose the correct option

Q4.

SELECT a.name AS emp1, b.name AS emp2, a.dept_id FROM employees a JOIN employees b ON a.dept_id = b.dept_id AND a.emp_id < b.emp_id;
What does a.emp_id < b.emp_id prevent?
A. Null values
B. Duplicate pairs
C. Wrong departments
D. Self-matching
Direction: Choose the correct option

Q5.

SELECT p1.name, p2.name, p1.price FROM products p1 JOIN products p2 ON p1.price = p2.price AND p1.id < p2.id;
What does this query find?
A. All products
B. Products with different prices
C. Products with same price (excluding self)
D. Expensive products