Direction: Choose the correct option
Q1.
What is a derived table?
Direction: Choose the correct option
Q2.
SELECT dept_id, avg_salary FROM (SELECT dept_id, AVG(salary) AS avg_salary FROM employees GROUP BY dept_id) AS dept_avg WHERE avg_salary > 50000;What is 'dept_avg'?Direction: Choose the correct option
Q3.
SELECT d.dept_name, stats.emp_count FROM departments d JOIN (SELECT dept_id, COUNT(*) AS emp_count FROM employees GROUP BY dept_id) AS stats ON d.id = stats.dept_id;What is being joined?Direction: Choose the correct option
Q4.
SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY dept_id ORDER BY salary DESC) AS rn FROM employees) AS ranked WHERE rn <= 3;What does this find?Direction: Choose the correct option
Q5.
What is a limitation of derived tables?
