Knowledge Organiser: SQL

Part of SQL · Section 9 of 9

Topic SummaryUnit: 3.7 Relational Databases and SQLGCSE

This topic summary covers Knowledge Organiser: SQL 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 9 of 9 in this topic. Use this topic summary to connect the idea to the wider topic before moving on to questions and flashcards.

Knowledge Organiser: SQL

Key Terms
  • SQL: Structured Query Language — used to query and manage databases
  • SELECT: Specifies which columns to retrieve
  • FROM: Specifies the table to query
  • WHERE: Filters rows by a condition
  • ORDER BY: Sorts the results (ASC = ascending, DESC = descending)
  • Wildcard (*): Selects all columns in a table
Must-Know Facts
  • SQL keyword order: SELECT ... FROM ... WHERE ... ORDER BY
  • String values in WHERE must be in quotes: WHERE city = "London"
  • Number values do not use quotes: WHERE age > 16
  • Use AND to require multiple conditions; use OR for either condition
  • SELECT * returns all columns; name specific columns to limit output
  • ASC sorts lowest to highest; DESC sorts highest to lowest
Key Concepts
  • Get all data: SELECT * FROM Students
  • Filter rows: SELECT name FROM Students WHERE age > 16
  • Sort results: ORDER BY score DESC
  • Multiple conditions: WHERE age >= 16 AND city = "London"
  • Memory aid: S-F-W-O — Select, From, Where, Order by
Common Mistakes
  • Getting the SQL keyword order wrong: The correct order is SELECT ... FROM ... WHERE ... ORDER BY — putting WHERE before FROM will cause a syntax error
  • Forgetting quotes around string values: String comparisons in WHERE require quotes: WHERE name = "Ali"; numeric comparisons do not: WHERE age > 16
  • Using = instead of > or < for numeric ranges: WHERE age = 16 only matches exactly 16; use >= or <= for ranges
  • Forgetting ORDER BY comes last: ORDER BY must appear after WHERE — placing it in the middle causes a syntax error
  • Confusing AND and OR in WHERE clauses: AND requires both conditions to be true; OR requires at least one — mixing them up produces incorrect results

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 WHERE do?
Filters rows based on conditions
What does SELECT do?
Chooses which columns to display

19 questions on SQL — practise free

Instant marking, adaptive difficulty and spaced-repetition flashcards — all aligned to your exam board.

Start revising free →