Table 1 shows part of a Students table that a school has created.
Table 1
| StudentID | FirstName | LastName | DateOfBirth |
|---|---|---|---|
| 1225 | William | Smith | 15/04/2009 |
| 1226 | Sid | Chopra | 04/11/2008 |
| 1227 | Freddie | Brown | 28/01/2009 |
| 1228 | William | Jones | 13/09/2008 |
Table 2 shows part of a Grades table in the same database.
Table 2
| StudentID | Subject | Percentage | Grade |
|---|---|---|---|
| 1225 | Maths | 78 | 8 |
| 1227 | Computer Science | 61 | 6 |
| 1226 | Chemistry | 94 | 9 |
| 1227 | Chemistry | 81 | 8 |
| 1228 | Geography | 69 | 7 |
State the name of the primary key of the
Students table. [1]
Tap/click to reveal
StudentID ✓
What is the most appropriate data type for the
Subject field? [1]
Tap/click to reveal Varchar ✓
Define the term "foreign key". [1]
Tap/click to reveal The foreign key of a table is the primary key of another table. ✓
Write a SQL statement to retrieve the StudentID, FirstName, LastName, Subject, and Percentage of any record
in the Grades table with a score of at least 70%. The results should be sorted by surname, A to Z. [5]
Tap/click to reveal
SELECT FirstName,
LastName, Subject,
Percentage ✓
FROM
Students, Grades ✓
WHERE
Students.StudentID =
Grades.StudentID ✓
AND Percentage >=
70 ✓
ORDER BY
LastName ASC ✓