Save
AQA GCSE Computer Science
3.7 Relational databases and structured query language (SQL)
3.7.2 Structured Query Language (SQL)
Save
Share
Learn
Content
Leaderboard
Share
Learn
Cards (113)
A column in a relational database table defines the type of data stored in each
row
Relational
databases
use a structured, tabular format to organize data
True
Match the SQL statement with its description:
SELECT ↔️ Retrieves specific columns
FROM ↔️ Specifies the table
WHERE ↔️ Filters data based on a condition
A table in a relational
database
contains related data in rows and columns
True
SQL syntax is fundamental for querying and manipulating
relational databases
True
A row in a
table
represents a single record
True
The SELECT, FROM, and WHERE statements are fundamental in SQL
True
What does the `SELECT` statement in SQL specify?
Columns to retrieve
How do you retrieve all columns from a table in SQL?
SELECT *
What does the `WHERE` clause in SQL allow you to do?
Filter rows
The `WHERE` clause is used to filter rows based on specified
conditions
.
True
Why is the `WHERE` clause considered a powerful tool in SQL?
For filtering data
The `
ASC
` keyword in SQL sorts data in ascending order.
True
Steps to retrieve and sort data using SQL
1️⃣ Write the `SELECT` clause to specify columns
2️⃣ Write the `FROM` clause to identify the table
3️⃣ Use the `WHERE` clause to filter rows
4️⃣ Use the `ORDER BY` clause to sort the result
What is the purpose of the `LIMIT` clause in SQL?
Limit row count
Match the join type with its description:
INNER JOIN ↔️ Returns rows where the join condition is met in both tables
LEFT JOIN ↔️ Returns all rows from the left table and matching rows from the right
RIGHT JOIN ↔️ Returns all rows from the right table and matching rows from the left
What are the `UPDATE` and `INSERT` statements used for in SQL?
Modify and add data
The UPDATE statement is used to modify existing
data
Steps to update data in SQL using the UPDATE statement
1️⃣ Specify the table name
2️⃣ List columns and their new values using SET
3️⃣ Filter rows to update using WHERE
The INSERT statement is used to add new
rows
What does the VALUES clause in the INSERT statement provide?
Values for each column
A relational database stores data in
tables
A column in a relational database defines the type of data stored in each row.
True
What is the purpose of the WHERE clause in a SELECT statement?
Filters data based on condition
The WHERE clause is used to filter rows based on specified
conditions
The ORDER BY clause sorts rows in
ascending
order by default.
True
What is the result of the query `SELECT name, age FROM users ORDER BY age DESC;`?
Users sorted by age descending
To retrieve the top 5 users by age in descending order, you would use the LIMIT clause with the value
5
What does the query `SELECT name, age FROM users ORDER BY age DESC LIMIT 5;` retrieve?
Top 5 oldest users
The ORDER BY clause is used with the
LIMIT
clause to sort the result set
True
Joining tables
in SQL combines data based on a common
column
A
LEFT JOIN
returns all rows from the left table, plus matching rows from the right table
True
The UPDATE statement in SQL modifies existing data in a
table
The COUNT aggregate function in SQL counts the number of
rows
Match the aggregate function with its description:
COUNT ↔️ Counts rows
SUM ↔️ Calculates total
AVG ↔️ Calculates average
A relational database stores data in
tables
A relational database stores data in
tables
In a relational database, a column defines the type of data stored in each
row
What does the SELECT statement do in SQL?
Retrieves specific columns
What is the purpose of the WHERE clause in SQL?
Filters data based on condition
See all 113 cards