Your progress
0%

Year 10 Digital Technology

SQL:
Asking questions
of a database.

You've already built a Netflix database in Microsoft Access. Now learn the language that powers every database on the planet — from Netflix itself to your school's student records.

You already have the data. Now what?

Think back to your Netflix database. You had four tables full of information about subscribers, countries, movies, and viewing history. But how does Netflix actually use that data? How does it know what to recommend to you? How does it know which country has the most active subscribers?

The answer is SQL — Structured Query Language. SQL is the language you use to talk to a database and ask it questions. Instead of scrolling through thousands of rows by hand, you write a short instruction and the database gives you exactly the answer you need.

Real world Every time Netflix recommends a show, every time you get a Google search result, every time your bank checks your balance — SQL is running behind the scenes. It is the most widely used database language in the world, and it has barely changed since the 1970s.

SQL vs Microsoft Access — what's the difference?

Microsoft Access gives you a visual interface: you click buttons, fill in forms, and drag things around. SQL does the same things, but with words. That might sound harder, but it's actually more powerful — you can do things in one line of SQL that would take dozens of clicks in Access.

What you did in Access

Open the Subscribers table → scroll until you find Australian subscribers → count them manually.

What SQL does instead

SELECT COUNT(*)
FROM Subscribers
WHERE CountryCode = 'AU';

The four things SQL can do

This unit focuses on SELECT first, because it's the foundation of everything. Once you can read data, adding and changing it is straightforward.

Your database for this unit

To keep things familiar, we're using a version of your Netflix database. Click the Dataset tab at any time to see the full tables. Here's a quick preview of what's in each one:

How the editor works Each lesson has a live SQL editor. Type your query, press Run and the result appears below. Everything runs in your browser — no internet connection or real database needed. Your work is automatically saved.

Lesson 1 of 2 · ~100 minutes

SELECT,
FROM
& WHERE.

Learn to read data from a database — choosing exactly which columns you want, from which table, filtered to show only the rows you care about.

1.1 — Getting everything: SELECT *

The simplest possible SQL query selects every row and every column from a table. The asterisk (*) means "everything".

SELECT *
FROM Subscribers;

Think of this as saying: "Show me everything inside the Subscribers table."

SQL is not case-sensitive — but convention matters Writing SELECT in capitals is a habit professionals use to make queries easier to read. The database doesn't care, but your teacher does!

Try it yourself. The editor below already has this query. Press Run to see the result.

sql_editor_1a.sql

1.2 — Choosing specific columns

Most of the time you don't need every column. You can list just the ones you want, separated by commas.

SELECT FirstName, LastName, Plan
FROM Subscribers;

This says: "From the Subscribers table, show me only the FirstName, LastName, and Plan columns." Everything else is ignored.

sql_editor_1b.sql

Challenge: Modify the query above to show only FirstName and Email. Check your answer by running it.


1.3 — Filtering with WHERE

The WHERE clause filters the rows returned. Only rows where the condition is true will appear in your results.

SELECT *
FROM Subscribers
WHERE Plan = 'Premium';

This says: "Show me all columns from Subscribers, but only for subscribers who are on the Premium plan."

Text values need quotes — numbers don't WHERE Plan = 'Premium' ← text needs single quotes
WHERE SubscriberID = 3 ← numbers don't need quotes
sql_editor_1c.sql

WHERE with comparison operators

WHERE can use all the comparison operators you know from maths:

sql_editor_1d.sql

1.4 — Combining conditions: AND / OR

You can chain multiple conditions together using AND (both must be true) or OR (either can be true).

SELECT Title, Genre, Rating
FROM Movies
WHERE Genre = 'Drama' AND Rating = 'M';
sql_editor_1e.sql

Challenge: Write a query that finds all subscribers on the 'Basic' plan who joined from country code 'AU'. Use the editor above.


Lesson 1 — Quick Check

Test yourself on what you've learned so far. Answers are saved automatically.

Question 1 of 4
What does the asterisk (*) mean in SELECT *?
Question 2 of 4
Which of the following correctly selects only the Title and Genre from the Movies table?
Question 3 of 4
A student writes: SELECT * FROM Movies WHERE Genre = Action. What is wrong with this query?
Question 4 of 4
You want to find all movies that are either 'Action' OR 'Comedy'. Which WHERE clause is correct?

Drag and Drop — Build a query

Arrange the SQL clauses below in the correct order to answer: "Show me the first name and email of all subscribers on the Premium plan."

Arrange the clauses

Drag each clause into the numbered slots below. The order of SQL clauses matters!

WHERE Plan = 'Premium'
FROM Subscribers
SELECT FirstName, Email
1st clause
2nd clause
3rd clause

Match keyword to purpose

Drop each SQL keyword into the correct description.

WHERE
FROM
SELECT
AND
Chooses which columns to return
Specifies which table to look in
Filters rows by a condition
Combines two conditions (both must be true)

✅ End of Lesson 1 checkpoint. You should now be able to select specific columns, filter rows with WHERE, and combine conditions. Head to Lesson 2 when you're ready.

Lesson 2 of 2 · ~100 minutes

ORDER BY,
UPDATE, INSERT
& JOIN.

Sort your results, modify existing records, add new ones, and ask questions that span two tables at once.

2.1 — Sorting results: ORDER BY

By default, a query returns rows in the order they were stored. ORDER BY lets you sort the results by any column — either ascending (A→Z, 0→9) or descending (Z→A, 9→0).

SELECT Title, ReleaseYear, DurationMins
FROM Movies
ORDER BY ReleaseYear DESC;

ASC = ascending (default, smallest first)  |  DESC = descending (largest first)

sql_editor_2a.sql

You can combine ORDER BY with WHERE:

sql_editor_2b.sql

2.2 — Changing records: UPDATE

UPDATE lets you change the value of one or more fields in existing records. Always use a WHERE clause — without it, you'll update every single row in the table!

UPDATE Subscribers
SET Plan = 'Premium'
WHERE SubscriberID = 3;
⚠ Always include WHERE with UPDATE Without WHERE, UPDATE changes every row. UPDATE Subscribers SET Plan = 'Premium' would move every subscriber to Premium — no undo button in real databases!
sql_editor_2c.sql

2.3 — Adding records: INSERT INTO

INSERT INTO adds a new row to a table. You list the column names, then provide the matching values in the same order.

INSERT INTO Subscribers
  (FirstName, LastName, Email, CountryCode, Plan)
VALUES
  ('Taylor', 'Swift', 'taylor@swift.com', 'US', 'Premium');
Note We don't include SubscriberID because it's an AutoNumber — the database assigns it automatically, just like in Access.
sql_editor_2d.sql

2.4 — Combining tables: JOIN

This is where SQL becomes truly powerful. Your Netflix database has four tables that are linked together. A JOIN lets you pull information from two (or more) tables at once by matching values in related columns.

Remember: in your Access database, the Subscribers table has a CountryCode field that links to the Countries table. In SQL, we can ask: "Show me each subscriber's name AND their full country name."

SELECT Subscribers.FirstName,
       Subscribers.LastName,
       Countries.CountryName
FROM Subscribers
INNER JOIN Countries
  ON Subscribers.CountryCode = Countries.CountryCode;

The ON clause tells SQL how to match rows between the two tables — using the CountryCode that appears in both. This is exactly the relationship you set up with Referential Integrity in Access.

sql_editor_2e.sql

JOIN with WHERE and ORDER BY

You can add WHERE and ORDER BY to any JOIN query, making it even more specific:

sql_editor_2f.sql

A three-table connection

Can you figure out which subscriber watched which movie? ViewingHistory links SubscriberID and MovieID — but it only stores the numbers. Use two JOINs to get the actual names:

sql_editor_2g.sql

Lesson 2 — Quick Check

Question 1 of 4
What does ORDER BY DurationMins DESC do?
Question 2 of 4
A student runs UPDATE Movies SET Rating = 'G' without a WHERE clause. What happens?
Question 3 of 4
In a JOIN query, what does the ON clause specify?
Question 4 of 4
You want to add a new country 'Japan' with code 'JP' to the Countries table. Which statement is correct?

Drag and Drop — Lesson 2

Order the full query

Arrange all five clauses to produce: "Show me the title and release year of all Action movies, newest first."

FROM Movies
ORDER BY ReleaseYear DESC
WHERE Genre = 'Action'
SELECT Title, ReleaseYear
1st
2nd
3rd
4th

Fill in the JOIN blanks

A JOIN query has four key parts. Match each term to its role.

INNER JOIN
ON
FROM
SELECT
Picks which columns appear in the result
Specifies the first (main) table
Brings in the second table to combine with the first
Defines the matching column between the two tables

Extension task — assessment bonus

Finished early? Earn extra marks.

Read one article from the link below, then write a personal reflection of 100–200 words. Explain what the article was about and what your personal opinion is. Your reflection will be saved and included in your submission.

👉 adambspencer.substack.com

0 words

Reset all progress

This will permanently delete all your quiz answers, drag responses, and reflection from this browser. Download a backup first if you want to keep a copy.

Reference

The Dataset

Every SQL editor in this unit runs against this data. Use this page to understand the tables and plan your queries.

Key:  PK Primary Key   FK Foreign Key (links to another table)

Countries 12 rows

Reference table. CountryCode is the primary key — it appears as a foreign key in Subscribers.

Subscribers 10 rows

One row per subscriber. CountryCode is a foreign key linking to Countries.

Movies 12 rows

One row per movie. No foreign keys — it is linked from ViewingHistory.

ViewingHistory 15 rows

Records each viewing event. SubscriberID links to Subscribers; MovieID links to Movies.

My Progress

Your SQL
Summary.

Review your results, download a backup, or submit your work for assessment.

Quiz results

Your answers from the multiple-choice quizzes across both lessons.

—
Correct answers
8
Total questions
—
Drag tasks correct
—
Overall score

Reflection

Your extension reflection (if completed):

No reflection saved yet.

Save & submit

Download a backup of your progress, or copy your summary to paste into SIMON.