SQL & data Quiz

12 questions. Score 70% or more to pass this rank's quiz.

1. What is the difference between WHERE and HAVING?
2. Sunshine Grocers has 102 employees; 12 store managers have manager_id = NULL. How many rows does SELECT * FROM employees e INNER JOIN employees m ON e.manager_id = m.employee_id return?
3. stores has 12 rows and products has 27 rows. How many rows does SELECT * FROM stores CROSS JOIN products return?
4. What does SELECT COUNT(manager_id) FROM employees return if 12 of the 102 rows have NULL manager_id?
5. Which query finds customers who have never placed an order?
6. Scores 90, 90, 80 are ranked with RANK() and DENSE_RANK() (ORDER BY score DESC). What are the results?
7. What is the difference between UNION and UNION ALL?
8. In order_items, which expression gives total net sales?
9. Why does SELECT * FROM stores WHERE region = NULL return no rows even if some regions are missing?
10. In SQLite, what does SELECT 7 / 2; return?
11. Why does SELECT net_sales * 2 AS doubled FROM t WHERE doubled > 100 fail in most databases?
12. What does a query that starts with WITH monthly AS (SELECT ...) define?

More quizzes