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.
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
Q01.1Convert the binary number 11010100 into decimal.EasyQ01.2Convert the binary number 10111001 into hexadecimal. You should show your working.MediumQ01.3State the largest decimal number that can be represented using 6 bits.EasyQ02.1Add together the following three binary numbers and give your answer in binary.
00110110
1001...MediumQ02.2Apply a binary shift three places to the right on the bit pattern 10101000. Give the result using...Easy
Expert