Library › Coding AI › High school students
Write a SQL query for your club's sign-in app
Practice: Giving the right context. About 5 minutes.
About this exercise
You're building the chess club's sign-in app and need the list of members who can play in Saturday's tournament: joined this school year (joined_on on or after 2026-08-15), paid dues (dues_paid = 1) and haven't left (left_on is NULL). Columns exactly first_name and last_name, sorted by last_name then first_name. Write one SQLite query in exactly 1 code block of at most 8 lines, under 30 words of text.
Common mistakes when you ask AI for this
- Not giving the date. The AI can't know your school year started Aug 15, so it guesses or skips the filter. Try: Add: "Only joined_on >= '2026-08-15'."
- Missing a rule. The AI might only check dues or only check left_on. Try: Add: "dues_paid = 1 AND left_on IS NULL."
- SELECT * and no order. The AI keeps SELECT * or sorts by first name. Try: Add: "Only first_name, last_name; ORDER BY last_name, first_name."
- A SQL lesson. The AI explains every keyword. Try: Add: "One query in one code block, one sentence at most."
What a strong prompt includes
- Gives the date
- Gives the other rules
- Names the columns
- Gives the sort
- Asks for one query
Related exercises
- Add a cron line that matches the others in a crontab (Coding AI · Product managers)
- Add dark mode by overriding your existing CSS variables (Coding AI · Software developers)
- Add input checks to your number guessing game (Coding AI · High school students)
- Add input validation to a Java method with exact messages (Coding AI · Software developers)
- Add labels to a signup form without rewriting the page (Coding AI · High school students)