← VCE Spreadsheets, SQL & Visualisation

What a database query is

A saved question asked of a table. It shows only the fields and records that answer it, as a new view, and leaves the original table unchanged.

Understanding What a database query is in VCE Spreadsheets, SQL & Visualisation

What it does: This asks 'which pets are dogs?'. The result is a new view of just the dogs, and the Pets table stays the same. A query asks a question of the data. It shows the answer without replacing or rebuilding the table. Criteria are the rules a record must meet to appear, such as Year = 8. Sorting only arranges the results, for example A to Z or highest to lowest. It never deletes anything. A filter usually just hides rows for a moment. A query is saved and sets the fields, criteria and sort order together. A query only chooses what to show. The Age field is still in the table.

Common mistakes: FROM must name the table the question is asked of, which is Pets. OldPets is the name of the query, not a table. It should be FROM Pets. A query only asks a question and leaves the table unchanged. It must not delete anything. The first line should name the query: QUERY BigTeams.

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 45–54) and word search (Modules 35–54).

Take this worksheet further — free with Cloodit

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

Learning
Duo
What is a database query?
A new table that replaces the old oneA saved question asked of a table
Matches
A student deletes the Year 7 records from the Students table to 'show only Year 8'
↓
This changes the table. A query should only show the Year 8 records in a new view and leave all the original records in place.
Applying
Meanings
Term
query
Meaning
A saved question asked of a table. It shows only the fields and records that answer it, as a new view, and leaves the original table unchanged.
Practice
SELECT Name, Year
Testing
Gaps
Name, Year
Check Answer
Spots
1QUERY OldPets
2FROM OldPets

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

The 'Coelacanth' badge — Living Fossil, 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. What is a database query?
A. A saved question asked of a table ✓
B. A new table that replaces the old one
A query asks a question of the data. It shows the answer without replacing or rebuilding the table.
2. A query is run on a Students table. What happens to the original table?
A. The rows that did not match are deleted
B. It stays unchanged ✓
The result is a new view. The records that were left out are still safe in the original table.
3. Which part of a query picks which columns to show?
A. The fields ✓
B. The sort order
Fields are the columns. A query can show just the ones that answer your question, like Name and Year.
4. Which part of a query decides which records (rows) are included?
A. The field names
B. The criteria ✓
Criteria are the rules a record must meet to appear, such as Year = 8.
5. What does the sort order in a query control?
A. The order the results are listed in ✓
B. Which records are deleted
Sorting only arranges the results, for example A to Z or highest to lowest. It never deletes anything.

Match the Pairs

SELECT Name, Year FROM Students → A query that shows only the Name and Year fields from the Students table
WHERE Year = 8 → A criteria that keeps only the records where Year is 8
A query asks a question of a table and shows the answer as a new view, without changing the table → SELECT * FROM Pets WHERE Type = 'Dog'
A query can set a sort order so the results are shown in a chosen order → ORDER BY Score DESC
A student deletes the Year 7 records from the Students table to 'show only Year 8' → This changes the table. A query should only show the Year 8 records in a new view and leave all the original records in place.
SELECT Name FROM Students WHERE Year = 8, to show each student's name and their score → The query only selects the Name field, so Score is not shown. Add Score to the fields list: SELECT Name, Score.

Key Term

query
A saved question asked of a table. It shows only the fields and records that answer it, as a new view, and leaves the original table unchanged.

Fill in the Blanks

1. SELECT Name, Year FROM Students
Hint: Type the keyword that chooses which fields the query shows.
2. SELECT Name, Year FROM Students
Hint: Type the keyword that names the table the question is asked of.
3. SELECT Name FROM Students WHERE Year = 8
Hint: Type the keyword that starts the criteria, so only matching records show.
4. SELECT Name FROM Students WHERE Year = 8
Hint: Type the comparison operator that tests whether two values are the same.
5. SELECT Name, Score FROM Students ORDER BY Score DESC
Hint: Type the sort order keyword that lists the highest score first.

Spot the Error

Question 1
A QUERY OldPets
B FROM OldPets
C SHOW Name, Age
D WHERE Age > 8
Line B — FROM must name the table the question is asked of, which is Pets. OldPets is the name of the query, not a table. It should be FROM Pets.
Question 2
A DELETE Teams
B FROM Teams
C SHOW Team, Players
D WHERE Players > 20
Line A — A query only asks a question and leaves the table unchanged. It must not delete anything. The first line should name the query: QUERY BigTeams.
Question 3
A QUERY Class8B
B FROM Students
C SHOW Name, Class
D WHERE Class = 8B
Line D — A text criterion must go inside quotes. It should be WHERE Class = "8B".
Question 4
A QUERY LongMovies
B FROM Movies
C SHOW Tittle, Length
D WHERE Length > 120
Line C — A field name must match the table exactly. Tittle is a misspelling, so the query cannot find that field. It should be SHOW Title, Length.
Question 5
A FROM Games
B SHOW Player Score
C SORT BY Score DESC
Line B — The fields in a SHOW line must be separated by commas. It should be SHOW Player, Score.

Student with a class code? Join your class →