Ad Banner Placeholder

Cambridge IGCSE Computer Science · 0478

Topic 9: Databases — Part 4

SQL Commands

SQL commands

SQL (Structured Query Language) is used to retrieve and analyse data stored in a database. The main commands you need to know for Cambridge IGCSE are:

Command / keyword Purpose
SELECT Identifies the specific fields (columns) to be retrieved
FROM Identifies the table being queried
WHERE Sets the specific conditions for the search
ORDER BY Sorts the results based on a specified field
ASCENDING Sorts records from lowest to highest (A→Z, 0→9)
DESCENDING Sorts records from highest to lowest (Z→A, 9→0)
SUM Aggregate function that adds up all values in a numeric field
COUNT Aggregate function that counts records meeting a condition
AND Combines conditions in WHEREboth must be true for a record to match
OR Combines conditions in WHEREeither condition can be true for a record to match
* (wildcard) Used with SELECT to return all attributes (fields)

A typical query follows this order: SELECT fields FROM table WHERE condition ORDER BY field ASCENDING or DESCENDING. Use AND when every condition must match; use OR when any one condition is enough.

0/15

Ad Banner Placeholder