ProgrammingStudy Notes

Practical SQL Query Examples

Part of SQLGCSE Computer Science

This study notes covers Practical SQL Query Examples within SQL for GCSE Computer Science. Revise SQL in Programming for GCSE Computer Science with 15 exam-style questions and 10 flashcards. This topic appears regularly enough that it should still be part of a steady revision cycle. It is section 6 of 8 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 8

Practice

15 questions

Recall

10 flashcards

Practical SQL Query Examples

Given this Students table:

StudentIDNameAgeCityScore
1Alice15London85
2Bob17Manchester72
3Charlie16London91
4Diana17Leeds68
5Eve15London95

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?

  • A. FROM
  • B. WHERE
  • C. SELECT
  • D. ORDER BY
1 markfoundation

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.

3 marksstandard

Quick Recall Flashcards

What does SELECT do?
Chooses which columns to display
What does WHERE do?
Filters rows based on conditions

Want to test your knowledge?

PrepWise has 15 exam-style questions and 10 flashcards for SQL — with adaptive difficulty and instant feedback.

Join Alpha