Easy2 marksStructured

AQA GCSE · Question 18.6 · Relational databases and structured query language (SQL)

A new member joins the youth club. The following SQL is run to add their details to the database:
INSERT INTO A (B) VALUES (5, 'Alina', 'Ahmed', '2020-11-30')
Some of the SQL has been replaced by labels. State the SQL that should have been written in place of the labels A and B.

How to approach this question

1. **Identify the task:** The SQL statement is adding a *new member*. 2. **Find label A:** The `INSERT INTO` command is followed by the table name. Which table stores member details? Look at the schema provided. It's the `Member` table. So, A is `Member`. 3. **Find label B:** The part in parentheses after the table name lists the columns into which the data will be inserted. The `VALUES` clause provides the data: `5`, `'Alina'`, `'Ahmed'`, `'2020-11-30'`. Match these values to the columns in the `Member` table. `5` is the `MemberID`, `'Alina'` is the `FirstName`, `'Ahmed'` is the `LastName`, and `'2020-11-30'` is the `DateJoined`. So, B is the list of these column names.

Full Answer

A: Member B: MemberID, FirstName, LastName, DateJoined
The `INSERT INTO` statement in SQL is used to add new records to a table. The general syntax is `INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);`. - **Label A:** This is the `table_name`. Since the query is adding a new member's details, the data should be inserted into the **Member** table. - **Label B:** This is the list of columns (`column1, column2, ...`) that the values correspond to. The values are `(5, 'Alina', 'Ahmed', '2020-11-30')`. Looking at the `Member` table structure, these values match the columns: - `5` -> `MemberID` - `'Alina'` -> `FirstName` - `'Ahmed'` -> `LastName` - `'2020-11-30'` -> `DateJoined` Therefore, B should be the list of these column names: **MemberID, FirstName, LastName, DateJoined**. The full, correct statement would be: `INSERT INTO Member (MemberID, FirstName, LastName, DateJoined) VALUES (5, 'Alina', 'Ahmed', '2020-11-30');`

Common mistakes

✗ Getting the table name wrong for A. ✗ Forgetting one of the column names for B. ✗ Putting the column names in an order that doesn't match the VALUES clause for B.

Practice the full AQA GCSE Computer Science Paper 2

46 questions · hints · full answers · grading

More questions from this exam