Length check
Presence check
Range check
Note - Number data types cannot have a field size - they are determined based on their data type (e.g. Integer or Double)
| StudentID | Forename | Surname | House |
|---|---|---|---|
| 006 | Charlee | Goodsman | G |
| 007 | James | Bond | G |
| 008 | Andrea | Campbell | L |
| 009 | Alicia | Coyle | L |
| 010 | Gavin | Boyle | G |
| 011 | Steven | Wren | T |
| 012 | Angela | MacDonald | T |
| 013 | William | MacKay | L |
| Guidance Teacher | Guidance Room |
|---|---|
| Mr Kyle | 1.3 |
| Mr Kyle | 1.3 |
| Mr Madison | 1.8 |
| Mr Madison | 1.8 |
| Mr Kyle | 1.3 |
| Miss Smith | 2.5 |
| Miss Smith | 2.5 |
| Mr Madison | 1.8 |
| Student |
|---|
| GuidanceTeacher |
|---|
| StudentID | Forename | Surname | House |
|---|---|---|---|
| 006 | Charlee | Goodsman | G |
| 007 | James | Bond | G |
| 008 | Andrea | Campbell | L |
| 009 | Alicia | Coyle | L |
| 010 | Gavin | Boyle | G |
| 011 | Steven | Wren | T |
| 012 | Angela | MacDonald | T |
| 013 | William | MacKay | L |
| Guidance Teacher | Guidance Room |
|---|---|
| Mr Kyle | 1.3 |
| Mr Kyle | 1.3 |
| Mr Madison | 1.8 |
| Mr Madison | 1.8 |
| Mr Kyle | 1.3 |
| Miss Smith | 2.5 |
| Miss Smith | 2.5 |
| Mr Madison | 1.8 |
| Student |
|---|
| GuidanceTeacher |
|---|
Make sure to name all entities!
| Author |
|---|
| AuthorID |
| AuthorName |
| AuthorDateOfBirth |
| Book |
|---|
| BookISBN |
| BookTitle |
| AuthorID* |
| BookPublishYear |
writes
One author writes (infinitly) many books
(or (infinitly) many books are written by one author)
∞
1
| Author |
|---|
| AuthorID |
| AuthorName |
| AuthorDateOfBirth |
| Book |
|---|
| BookISBN |
| BookTitle |
| AuthorID* |
| BookPublishYear |
writes
∞
1
In this example we are looking at authors and books.
One author writes (infinitly) many books
(or (infinitly) many books are written by one author)
| StudentID | Forename | Surname | House |
|---|---|---|---|
| 006 | Alex | Smith | G |
| 007 | James | Bond | G |
| 008 | Mark | Adams | L |
| 009 | David | Gyle | L |
| 010 | Gavin | Boyle | G |
| 011 | Steven | Wren | T |
| 012 | Angela | MacDonald | T |
| 013 | William | MacKay | L |
| Guidance Teacher | Guidance Room |
|---|---|
| Mr Kyle | 1.3 |
| Mr Kyle | 1.3 |
| Mr Madison | 1.8 |
| Mr Madison | 1.8 |
| Mr Kyle | 1.3 |
| Miss Smith | 2.5 |
| Miss Smith | 2.5 |
| Mr Madison | 1.8 |
| Student |
|---|
| GuidanceTeacher |
|---|
Book
Author
writes
BookISBN
BookTitle
BookAuthor*
BookPublishYear
AuthorID
AuthorName
AuthorDateOfBirth
| Guidance Teacher | Guidance Room |
|---|---|
| Mr Kyle | 1.3 |
| Mr Kyle | 1.3 |
| Mr Madison | 1.8 |
| Mr Madison | 1.8 |
| Mr Kyle | 1.3 |
| Miss Smith | 2.5 |
| Miss Smith | 2.5 |
| Mr Madison | 1.8 |
| Student |
|---|
| GuidanceTeacher |
|---|
| StudentID | Forename | Surname | House |
|---|---|---|---|
| 006 | Charlee | Goodsman | G |
| 007 | James | Bond | G |
| 008 | Andrea | Campbell | L |
| 009 | Alicia | Coyle | L |
| 010 | Gavin | Boyle | G |
| 011 | Steven | Wren | T |
| 012 | Angela | MacDonald | T |
| 013 | William | MacKay | L |
| StudentID | Forename | Surname | House* |
|---|---|---|---|
| 006 | Charlee | Goodsman | G |
| 007 | James | Bond | G |
| 008 | Andrea | Campbell | L |
| 009 | Alicia | Coyle | L |
| 010 | Gavin | Boyle | G |
| 011 | Steven | Wren | T |
| 012 | Angela | MacDonald | T |
| 013 | William | MacKay | L |
| House | Guidance Teacher | Guidance Room |
|---|---|---|
| G | Mr Kyle | 1.3 |
| G | Mr Kyle | 1.3 |
| L | Mr Madison | 1.8 |
| L | Mr Madison | 1.8 |
| G | Mr Kyle | 1.3 |
| T | Miss Smith | 2.5 |
| T | Miss Smith | 2.5 |
| L | Mr Madison | 1.8 |
| Student |
|---|
| GuidanceTeacher |
|---|
Create and populate with fake information the following databases from these tables (and in any validation required):
INSERT INTO
SELECT
UPDATE
DELETE FROM
| CPUs | ||||
|---|---|---|---|---|
| CPUID 🔑 | CPUName | TOPS | ChipPrice | Developer |
| 1 | Ryzen 9 AI HX 370 | 80 | 350.00 | 2 |
| 2 | Core Ultra 9 14900K | 51 | 450.00 | 1 |
| 3 | M3 Max | 38 | 600.00 | 5 |
| 4 | Snapdragon X | 45 | 350.00 | 3 |
| 5 | Ryzen 7 7840U | 16 | 280.00 | 2 |
| 6 | Core Ultra 7 155H | 11 | 320.00 | 1 |
| Developer | |||
|---|---|---|---|
| ID🔑 | DeveloperName | Country | CEO |
| 1 | Intel | USA | Pat Gelsinger |
| 2 | AMD | USA | Lisa Su |
| 3 | Qualcomm | China | Cristiano Amon |
| 4 | Samsung | South Korea | Kyung Kye-hyun |
| 5 | Apple | USA | Tim Cook |
| 6 | IBM | Taiwan | Arvind Krishna |
INSERT INTO CPUs VALUES (7, "Ryzen 9 7950X3D", 12, 420, 2);C
R
U
D
reate
| CPUs | ||||
|---|---|---|---|---|
| CPUID 🔑 | CPUName | TOPS | ChipPrice | Developer |
| 1 | Ryzen 9 AI HX 370 | 80 | 350.00 | 2 |
| 2 | Core Ultra 9 14900K | 51 | 450.00 | 1 |
| 3 | M3 Max | 38 | 600.00 | 5 |
| 4 | Snapdragon X | 45 | 350.00 | 3 |
| 5 | Ryzen 7 7840U | 16 | 280.00 | 2 |
| 6 | Core Ultra 7 155H | 11 | 320.00 | 1 |
| 7 | AMD Ryzen 9 7950X3D | 12 | 420.00 | 2 |
C
R
U
D
reate
C
R
U
D
ead
SELECT CPUName, ChipPrice
FROM CPUs
ORDER BY CPUName;
C
R
U
D
ead
SELECT fieldname1, fieldname2, fieldname3
FROM table1, table2
WHERE condition
ORDER BY field1 ASC/DESC, field2 ASC/DESC
SELECT *
FROM CPUs
WHERE TOPS > 25;
SELECT *
FROM CPUs
WHERE TOPS > 25
ORDER BY ChipPrice ASC, CPUName ASC;
C
R
U
D
ead
| CPUs | ||||
|---|---|---|---|---|
| CPUID 🔑 | CPUName | TOPS | ChipPrice | Developer |
| 1 | Ryzen 9 AI HX 370 | 80 | 350.00 | 2 |
| 4 | Snapdragon X | 45 | 350.00 | 3 |
| 2 | Core Ultra 9 14900K | 51 | 450.00 | 1 |
| 3 | M3 Max | 38 | 600.00 | 5 |
C
R
U
D
ead
| CPUs |
|---|
| Developer |
| 2 |
| 1 |
| 5 |
| 3 |
| 2 |
| 1 |
| Developer |
|---|
| ID🔑 |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
Foreign key
Primary key
C
R
U
D
ead
| CPUs |
|---|
| Developer |
| 2 |
| 1 |
| 5 |
| 3 |
| 2 |
| 1 |
| Developer |
|---|
| ID🔑 |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
Foreign key
Primary key
SELECT *
FROM table1, table2
WHERE table1.foreignKey = table2.primaryKey
ORDER BY table1.foreignKey
SELECT CPUID, CPUName, TOPS, DeveloperName, Country
FROM CPUs, Developer
WHERE CPUs.Developer = Developer.ID AND TOPS > 25
ORDER BY ChipPrice ASC, CPUName ASC;
C
R
U
D
ead
| CPUs | ||
|---|---|---|
| CPUID 🔑 | CPUName | TOPS |
| 1 | Ryzen 9 AI HX 370 | 80 |
| 4 | Snapdragon X | 45 |
| 2 | Core Ultra 9 14900K | 51 |
| 3 | M3 Max | 38 |
| Developer | |
|---|---|
| DeveloperName | Country |
| AMD | USA |
| Qualcomm | China |
| Intel | USA |
| Apple | USA |
UPDATE CPUs
SET ChipPrice = 400.00, ChipName = "Core Ultra 9 14900K (used)"
WHERE CPUID = 2
C
R
U
D
pdate
C
R
U
D
pdate
| CPUs | ||||
|---|---|---|---|---|
| CPUID 🔑 | CPUName | TOPS | ChipPrice | Developer |
| 1 | Ryzen 9 AI HX 370 | 80 | 350.00 | 2 |
| 2 | Core Ultra 9 14900K (used) | 51 | 400.00 | 1 |
| 3 | M3 Max | 38 | 600.00 | 5 |
| 4 | Snapdragon X | 45 | 350.00 | 3 |
| 5 | Ryzen 7 7840U | 16 | 280.00 | 2 |
| 6 | Core Ultra 7 155H | 11 | 320.00 | 1 |
| 7 | AMD Ryzen 9 7950X3D | 12 | 420.00 | 2 |
C
R
U
D
elete
DELETE FROM CPUs
WHERE CPUID = 4
DELETE FROM CPUs
WHERE ChipPrice > 350.00
A new driver is to be added.
INSERT INTO Driver (driverNum, forename, surname, wins,
points, teamID) VALUES (99, "Thomas", "Webb", 0, 0, "PC81")
When this SQL statement is run, an error message is displayed stating that the record cannot be added.
Explain why an error message is displayed.
1 mark
2025 16 (d)
| Team | ||
|---|---|---|
| teamID | teamName | titlesWon |
| RR32 | Rapid Racers | 7 |
| SS21 | Swift Streaks | 3 |
| TT16 | Turbo Titans | 2 |
| VR12 | Velocity Vipers | 4 |
| ER54 | Elite Racers | 1 |
| PV81 | Prime Speed | 5 |
| Driver | |||||
|---|---|---|---|---|---|
| driverNum | forename | surname | wins | points | teamID |
| 1 | Shannon | Kelly | 5 | 125 | ER54 |
| 3 | Ezri | Wuzik | 2 | 50 | PV81 |
| 4 | Jackie | Price | 2 | 50 | RR32 |
| 11 | Kai | West | 4 | 100 | SS21 |
| 14 | Charlie | Wilkinson | 1 | 25 | TT16 |
| 18 | Moss | Gray | 0 | 0 | VR12 |
The relational database is implemented. Sample data from both tables is
shown.
The database is used to identify all customer names and addresses that have 5 or more windows and are allocated to staff member Fatima Khan.
Produce an SQL statement that would produce this output.
2023 14 (b) (i)
| House | ||||||
|---|---|---|---|---|---|---|
| houseID | customerName | address | directDebit | windows | cost | staffID |
| BON4523 | Claire Banks | 168 Ferry Place | Yes | 6 | 13 | 1613 |
| DAL8001 | Stephen Jones | 7F Millbank | No | 3 | 7 | 1752 |
| EDI3189 | Ian Collins | 15 Robin Ave | Yes | 8 | 12 | 1613 |
| ... | ... | ... | ... | ... | ... | ... |
| Staff | |||
|---|---|---|---|
| staffID | staffName | contactTel | hoursPerWeek |
| 2160 | Daniel Buchan | 07721454187 | 35 |
| 1613 | Jessie Tait | 07378565190 | 15 |
| 1752 | Nick Haig | 07745176623 | 27.5 |
| 1617 | Dagmara Dyner | 07178251143 | 35 |
| ... | ... | ... | ... |
The following are key shortcuts for using DragonSlides and reveal.js.
| Key combination | Action |
|---|---|
| →, PAGE DOWN, SPACE | Next slide |
| ←, PAGE UP | Previous slide |
| SHIFT + → | Last Slide |
| SHIFT + ← | First slide |
| B | Whiteboard |
| W | Widget Board/White Screen |
| C | Toggle Notes Canvas |
| DEL | Clears Whiteboard/Notes Canvas |
| S | Show Presenter Mode |
| SHIFT + D | Toggle Dark Mode |
| H | Goes to the Home Slide |
| META + P | Show Print options window |
In order to use the 'Start Remote' feature, you'll need to download JB Slide Controls from the Apple App Store. Once you have this you'll be able to control the slides using the app from you Apple Watch.
DragonSlides and jamiebalfour.scot are copyright © Jamie B Balfour 2017 - 2024, 2010 - 2024. Content is copyright © Jamie B Balfour
