Skills101
← All practice quizzes

Quiz: Checking AI-Written SQL

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

AI tools write SQL that runs without errors but returns the wrong numbers. Learn to verify generated queries on a tiny dataset with known answers, and catch the four classic bugs - inner joins that drop rows, COUNT(*) after a LEFT JOIN, NULL comparisons and join fan-out.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    Why is wrong SQL often more dangerous than wrong Python?

  2. Question 2

    "List every student with their submission count" returns 3 rows, but there are 5 students. What is the most likely cause?

  3. Question 3

    What does this print?

    import sqlite3
    db = sqlite3.connect(":memory:")
    db.executescript("CREATE TABLE s (id INT); CREATE TABLE sub (sid INT); INSERT INTO s VALUES (1); ")
    print(db.execute("SELECT COUNT(*), COUNT(sub.sid) FROM s LEFT JOIN sub ON sub.sid = s.id").fetchone())
    
  4. Question 4

    Why does WHERE branch != 'CSE' leave out a student whose branch is NULL?

  5. Question 5

    What does this print?

    import sqlite3
    db = sqlite3.connect(":memory:")
    print(db.execute("SELECT NULL = NULL, NULL IS NULL").fetchone())
    
🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →