Practical SQL Query Examples
Part of SQL · GCSE GCSE Computer Science revision
This study notes covers Practical SQL Query Examples within SQL for GCSE Computer Science. Revise SQL in 3.7 Relational Databases and SQL for GCSE Computer Science with 19 exam-style questions and 10 flashcards. This topic shows up very often in GCSE exams, so students should be able to explain it clearly, not just recognise the term. It is section 6 of 9 in this topic. Use this study notes to connect the idea to the wider topic before moving on to questions and flashcards.
Topic position
Section 6 of 9
Practice
19 questions
Recall
10 flashcards
Practical SQL Query Examples
Given this Students table:
| StudentID | Name | Age | City | Score |
|---|---|---|---|---|
| 1 | Alice | 15 | London | 85 |
| 2 | Bob | 17 | Manchester | 72 |
| 3 | Charlie | 16 | London | 91 |
| 4 | Diana | 17 | Leeds | 68 |
| 5 | Eve | 15 | London | 95 |
Query 1: All London students
SELECT Name, Age FROM Students WHERE City = "London" -- Returns: Alice (15), Charlie (16), Eve (15)
Query 2: Students aged 16+ sorted by score (highest first)
SELECT Name, Score FROM Students WHERE Age >= 16 ORDER BY Score DESC -- Returns: Charlie (91), Bob (72), Diana (68)
Query 3: London students with score over 90
SELECT * FROM Students WHERE City = "London" AND Score > 90 -- Returns: Charlie (91), Eve (95)
Query 4: Students from London OR Manchester
SELECT Name, City FROM Students WHERE City = "London" OR City = "Manchester" -- Returns: Alice, Bob, Charlie, Eve
Keep building this topic
Read this section alongside the surrounding pages in SQL. That gives you the full topic sequence instead of a single isolated revision point.
Practice Questions for SQL
Which SQL keyword is used to choose which columns to retrieve from a database table?
Explain the difference between using AND and OR to combine conditions in an SQL WHERE clause. Give an example of when each would be used.
Quick Recall Flashcards
19 questions on SQL — practise free
Instant marking, adaptive difficulty, and 10 spaced repetition flashcards. Free until your GCSEs.
Try PrepWise Free