The SELECT statement is the most important SQL command in IB Computer Science. It allows users to retrieve specific data from a database, turning stored records into useful information. In IB exams, students are often asked to write, interpret, or modify SELECT queries, so understanding how they work step by step is essential.
Examiners reward clarity of logic more than perfect syntax.
What Is a SELECT Query?
A SELECT query is used to:
- Retrieve data from a database table
- Choose specific fields
- Filter records
- Control how results are displayed
It does not change the data — it only reads it.
In IB terms, SELECT is used for data retrieval.
Basic Structure of a SELECT Query
A simple SELECT query follows this structure:
- SELECT field(s)
- FROM table
This tells the database:
- What data you want
- Where to find it
For example, selecting student names from a student table retrieves only that specific information, not the entire record.
Selecting All Fields
To retrieve all fields from a table, the wildcard symbol is used.
This tells the database:
- Return every column
- For every matching record
IB students should understand that:
- This is convenient
