Skip to content

SQL Quiz & Exercises πŸ†

Mentor's Note: Reading is good, but doing is better. Try to solve these problems without looking at the reference hub. If you can solve all 5, you are ready for your college exams! πŸ’‘


πŸ“ Part 1: Multiple Choice

Q1. Which clause is used to filter groups after they have been aggregated?

  • A) WHERE
  • B) ORDER BY
  • C) HAVING
  • D) DISTINCT

Q2. What is the result of 10 + NULL in SQL?

  • A) 10
  • B) 0
  • C) Error
  • D) NULL

πŸ’» Part 2: Practical Challenges

Challenge 1: The High Rollers πŸ’°

Problem: Find all employees who earn more than β‚Ή60,000 and sort them by name alphabetically.

View Solution
SELECT * FROM employees
WHERE salary > 60000
ORDER BY name ASC;

Challenge 2: The Missing Email πŸ“§

Problem: Count how many students have not provided an email address.

View Solution
SELECT COUNT(*) 
FROM students
WHERE email IS NULL;

Challenge 3: The Multi-Table Match πŸ•ΈοΈ

Problem: Show the emp_name and the dept_name for every employee using an INNER JOIN.

View Solution
SELECT E.emp_name, D.dept_name
FROM employees E
JOIN departments D ON E.dept_id = D.id;

πŸ“Š Self-Assessment

  • 0-2 Correct: Go back to Foundations. πŸ‘Ά
  • 3-4 Correct: Good progress! Review Joins. πŸ§—
  • 5 Correct: SQL Master! Move to PL/SQL. πŸŽ“

πŸ’‘ Pro Tip: "Consistency is what transforms average into excellence. Practice one query every day!"


πŸ“ˆ Learning Path