← ACARA Digital Technologies Years 7–8

Running an SQL query in a database tool

Type an SQL statement in the tool's query window, run it, then read the results table. If an error shows, read the message and fix the statement.

Understanding Running an SQL query in a database tool in ACARA Digital Technologies Years 7–8

What it does: The statement is typed in the query window and run, and the results table lists only students with more than 100 points. The message names the problem. The table is called students, so the spelling in FROM must match it. Error messages tell you what went wrong. Read them, fix the statement, then run it again. SELEC is spelled wrong, so the tool shows an error. SELECT must be spelled correctly. Always run it again and read the results to check that the fix worked. Reading the error message points to the unknown table name, which tells the student what to fix.

Common mistakes: Text values must be in quotes. Without them the tool reads Red as a field name and shows an error. It should be WHERE house = 'Red'. Sorting needs the keywords ORDER BY. The word BY is missing, so the tool shows a syntax error. It should be ORDER BY lastName;.

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 331–360) and word search (Modules 331–411).

Take this worksheet further — free with Cloodit

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

Learning
Duo
You have written SELECT * FROM students; in the SQL view of Access or Base. What do you do next?
Run the query and read the results tableClose the window and the results appear on their own
Matches
SELECT * FROM student;
↓
The table name is spelt wrong. The built-in table is called students, so the tool shows an error that the table cannot be found. Fix the name and run again.
Applying
Meanings
Term
SELECT * FROM students;
Meaning
Type an SQL statement in the tool's query window, run it, then read the results table. If an error shows, read the message and fix the statement.
Practice
SELECT firstName, house, points
Testing
Gaps
* FROM students;
Check Answer
Spots
2FROM students
3WHERE house = Red

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

The 'Sea Dragon' badge — OOP Pioneer, 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. You have written SELECT * FROM students; in the SQL view of Access or Base. What do you do next?
A. Close the window and the results appear on their own
B. Run the query and read the results table ✓
Typing the statement is only step one. You must run it, then read the results table the tool shows.
2. Which is the right place to type an SQL statement in a database tool?
A. The query window (SQL view) ✓
B. The table's Datasheet view where records are stored
SQL goes in the query window, often called SQL view. The datasheet only shows records.
3. You run SELECT * FROM students; on the practice data. What appears?
A. A results table showing every field of every student ✓
B. A message that says only how many students there are
The * means all fields, so you see a results table with all columns and all rows from students.
4. An online SQL practice editor shows the error: no such table: student. Which fix is best?
A. Change student to students, the real table name ✓
B. Add more rows to the student table
The message names the problem. The table is called students, so the spelling in FROM must match it.
5. Your query shows an error message. What should you do first?
A. Delete the database and start again
B. Read the message, then fix the statement ✓
Error messages tell you what went wrong. Read them, fix the statement, then run it again.

Match the Pairs

SELECT * FROM students; → A statement you type in the query window and run to show every field and record from the students table in the results table.
SELECT firstName, house FROM students; → A statement that, once run, gives a results table with only the firstName and house columns, so you check the columns match what you asked for.
Type a statement in the query window, run it, and the results table shows the matching records. → SELECT firstName, points FROM students WHERE points > 100;
When an error message says a table name is unknown, check the spelling and fix the statement before running it again. → SELECT * FROM students;
SELECT * FROM student; → The table name is spelt wrong. The built-in table is called students, so the tool shows an error that the table cannot be found. Fix the name and run again.
SELEC firstName FROM students; → The keyword SELECT is spelt wrong, so the tool shows a syntax error and no results table. Correct it to SELECT and run the statement again.

Key Term

SELECT * FROM students;
Type an SQL statement in the tool's query window, run it, then read the results table. If an error shows, read the message and fix the statement.

Fill in the Blanks

1. SELECT * FROM students;
Hint: Type the keyword that starts a query and chooses which fields to show.
2. SELECT * FROM students;
Hint: Type the keyword that tells SQL which table to read from.
3. SELECT firstName, house FROM students;
Hint: Type the name of the table that holds these fields.
4. -- Error: no such column: nme SELECT name FROM subjects;
Hint: Read the error comment, then type the correctly spelled field name from the subjects table.
5. SELECT * FROM students WHERE house = 'Red';
Hint: Type the keyword that filters the results table to only the rows that match.

Spot the Error

Question 1
A SELECT firstName, points
B FROM students
C WHERE house = Red
D ORDER BY points DESC;
Line C — Text values must be in quotes. Without them the tool reads Red as a field name and shows an error. It should be WHERE house = 'Red'.
Question 2
A SELECT firstName, lastName
B FROM students
C WHERE yearLevel = 8
D ORDER lastName;
Line D — Sorting needs the keywords ORDER BY. The word BY is missing, so the tool shows a syntax error. It should be ORDER BY lastName;
Question 3
A SELECT name, price
B FORM products
C WHERE price > 10;
Line B — FROM is spelled wrong. The error message would point at FORM. It should be FROM products.
Question 4
A SELECT *
B FROM student
C WHERE points > 100;
Line B — The table is called students, not student. The tool would say it cannot find the table. It should be FROM students.
Question 5
A SELECT name teacher
B FROM subjects
C ORDER BY name;
Line A — Field names in a SELECT list must be separated by commas. It should be SELECT name, teacher.

Student with a class code? Join your class →