← IGCSE Computer Science Paper 2

Field order in the output of a SELECT

The output has only the fields named, as columns in the order written after SELECT, with a heading row of field names and one row per record kept (all records if there is no WHERE).

Understanding Field order in the output of a SELECT in IGCSE Computer Science Paper 2

What it does: The output columns follow the order written after SELECT, so points is the first column and firstName is the second. Without a WHERE, all records are kept, so one row appears for each of the 10 students under the heading house. Swapping the field order only changes the column order. The same records are still shown. The heading row shows the names of the fields selected. The data rows come after it.

Common mistakes: The comment says house comes first, but the fields are written in the wrong order, so the columns would be firstName then house. It should be SELECT house, firstName. Field names in a SELECT list must be separated by commas. The comma is missing, so it should be SELECT lastName, points.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 525–538) and word search (Modules 500–538).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Query: SELECT lastName, firstName FROM students; Which column comes first in the output?
firstNamelastName
Matches
Query: SELECT house, firstName FROM students; Student expects: firstName column first, then house
↓
The fields are written in the wrong order. The output shows house first, so the query should be SELECT firstName, house FROM students;
Applying
Meanings
Term
SELECT lastName, firstName FROM students;
Meaning
The output has only the fields named, as columns in the order written after SELECT, with a heading row of field names and one row per record kept (all records if there is no WHERE).
Practice
SELECT lastName, firstName, house
Testing
Gaps
SELECT , firstName FROM students;
Check Answer
Spots
1-- Show house, then firstName
2SELECT firstName, house

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Hippopotamus' badge — Savannah Titan, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Query: SELECT lastName, firstName FROM students; Which column comes first in the output?
A. lastName ✓
B. firstName
Columns appear in the order written after SELECT, so lastName is first, then firstName.
2. Which query gives output with the columns house, then points?
A. SELECT points, house FROM students;
B. SELECT house, points FROM students; ✓
The output columns follow the order of the fields after SELECT, so house must be written first.
3. SELECT firstName FROM students; How many columns are in the output?
A. 1 column ✓
B. 6 columns
Only the field named after SELECT is shown. Fields not named, such as lastName and points, are left out.
4. The students table has 10 records. SELECT firstName, points FROM students; has no WHERE. How many rows of data does it output?
A. 10 rows ✓
B. 1 row
With no WHERE clause every record is kept, so there is one row for each of the 10 records.
5. Changing SELECT yearLevel, house to SELECT house, yearLevel changes the...
A. number of rows
B. order of the columns ✓
Swapping the field order only changes the column order. The same records are still shown.

Match the Pairs

SELECT lastName, firstName FROM students; → Shows two columns, lastName first and then firstName, for every student, because there is no WHERE
SELECT name, price FROM products; → Shows only the name and price columns; category and stock are left out of the output
Swapping the field order makes the columns appear in the opposite order, with the points column before the firstName column → SELECT points, firstName FROM students;
With no WHERE clause, every record in the table appears in the output, and the heading row shows the field names → SELECT house FROM students;
Query: SELECT house, firstName FROM students; Student expects: firstName column first, then house → The fields are written in the wrong order. The output shows house first, so the query should be SELECT firstName, house FROM students;
Query: SELECT firstName FROM students; Student expects: firstName and yearLevel columns → yearLevel is not named after SELECT, so it is left out of the output. It should be SELECT firstName, yearLevel FROM students;

Key Term

SELECT lastName, firstName FROM students;
The output has only the fields named, as columns in the order written after SELECT, with a heading row of field names and one row per record kept (all records if there is no WHERE).

Fill in the Blanks

1. -- Output columns: lastName, firstName SELECT lastName, firstName FROM students;
Hint: Type the field that must appear in the first column, as the comment says.
2. SELECT firstName, points FROM students;
Hint: Type the keyword that comes after the field list and names the table.
3. -- Every record, name then price SELECT name, price FROM products;
Hint: Type the table that holds these two fields. With no WHERE, every record is shown.
4. -- Show points first, then firstName SELECT points, firstName FROM students;
Hint: Type the field that must come first in the output columns.
5. -- Only studentId and mark are shown SELECT studentId, mark FROM results;
Hint: Type the second field named after SELECT. Fields not named are left out of the output.

Spot the Error

Question 1
A -- Show house, then firstName
B SELECT firstName, house
C FROM students;
Line B — The comment says house comes first, but the fields are written in the wrong order, so the columns would be firstName then house. It should be SELECT house, firstName.
Question 2
A -- Show lastName then points
B SELECT lastName points
C FROM students;
Line B — Field names in a SELECT list must be separated by commas. The comma is missing, so it should be SELECT lastName, points.
Question 3
A -- Only name and price columns
B SELECT name, price, stock
C FROM products;
Line B — Every field named after SELECT becomes a column in the output. stock is named but not wanted, so it should be SELECT name, price.
Question 4
A -- List every student's name
B -- (all records, no WHERE)
C SELECT firstName, lastName
D FROM student;
Line D — The table is called students. The table name after FROM must match exactly, so it should be FROM students;.
Question 5
A SELECT name, price, category
B FROM products;
C -- name, then category, price
Line A — The columns appear in the order the fields are written. The comment says category comes before price, so it should be SELECT name, category, price.

Student with a class code? Join your class →