A file is a collection of structured data on a particular topic. A file is made up of 1 or more records.
A record is a collection of structured data on a particular person or object. A record is made up of 1 or more fields.
A "record" is the technical name for a database table row and contains the actual data in a table.
Each record in a table contains the same fields but (usually) has different data in those fields.
A field is an area of a record that contains an individual piece of data.
A “field” is the technical name for a database table column and is used to denote a specific type of data.
The “Age” field (column) contains numeric data denoting customer age: Each field on a table holds only one type of data (for example, numerical data describing age)
| Forename | Surname |
|---|---|
| Charlee | Goodsman |
| James | Bond |
| Andrea | Campbell |
| Alicia | Coyle |
| Gavin | Boyle |
| Steven | Wren |
| Angela | MacDonald |
| William | MacKay |
| StudentID |
|---|
| 006 |
| 007 |
| 008 |
| 009 |
| 010 |
| 011 |
| 012 |
| 013 |
| Forename | Surname |
|---|---|
| Charlee | Goodsman |
| James | Bond |
| Andrea | Campbell |
| Alicia | Coyle |
| Gavin | Boyle |
| Steven | Wren |
| Angela | MacDonald |
| William | MacKay |
| StudentID |
|---|
| 006 |
| 007 |
| 008 |
| 009 |
| 010 |
| 011 |
| 012 |
| 013 |
What uniquely identifies each person in the school?
What uniquely identifies each person sitting National 5 Computing Science?
What uniquely identifies each member of staff working in the school?
| 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 |
Do we have any data replication here?
| 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 |
| 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!
| 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 |
|---|
| Author |
|---|
| AuthorID |
| AuthorName |
| AuthorDateOfBirth |
| Book |
|---|
| BookISBN |
| BookTitle |
| AuthorID* |
| BookPublishYear |
writes
One author writes (infinitely) many books
(or (infinitely) 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 (infinitely) many books
(or (infinitely) many books are written by one author)
A technology company employs contractors to carry out IT work. They create a database that contains information on all contractors including their name, temporary employee number, their hourly rate and their manager. The company create a relational database as a result, with managers being stored separately from employees. Managers have an employee number, their name, a promotion level and their own manager's employee number.
Create an entity relationship to show this.
| Manager |
|---|
| EmployeeNumber |
| Name |
| PromotionLevel |
| ManagerID |
| Contractor |
|---|
| TemporaryEmployeeNumber |
| Name |
| ManagerID* |
| HourlyRate |
manages
∞
1
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 |
|---|
A school has several different clubs such as a video games club, a chess club etc. One teacher manages each club but a teacher can manage multiple clubs (e.g. Mr Balfour runs the video games club and computing club).
Clubs have a unique ID, a name, a room name, and the maximum number of pupils allowed at the club. They also have an indication as to whether computers are used.
Teachers have an employee number, a name, a date of birth and their subject.
Create both types of entity relationship diagram for this database.
A property renovation company requires a relational database to store information about the tasks to be carried out on each room of a house.
The functional requirements for the database are identified:
Complete the entity relationship diagram below by identifying key attributes.
2 marks
2022 Q14 (a)
| Author |
|---|
| AuthorID |
| AuthorName |
| AuthorDateOfBirth |
| Book |
|---|
| BookISBN |
| BookTitle |
| AuthorID* |
| BookPublishYear |
| Author | |
|---|---|
| AuthorID | Number |
| AuthorName | Text |
| AuthorDateOfBirth | Date |
| Book | |
|---|---|
| BookISBN | Text |
| BookTitle | Text |
| AuthorID* | Number |
| BookPublishYear | Number |
Date
Time
Number
Text
Which attribute type should be used to store the year a person was born?
Boolean
Date
Time
Number
Text
Which attribute type should be used to store a telephone number?
Boolean
Date
Time
Number
Text
Which attribute type should be used to store if a person has been given a vaccine?
Boolean
| Validation | Description | Example |
|---|---|---|
| Presence check | The field is required and data must be provided | Email address is required. |
| Restricted choice | The data must be selected from a list of valid entries (normally a dropdown box) | Class could be 2L1, 2L2, 2G1, 2G2, 2T1 or 2T2 |
| Length check | The data must be of a specified length | Phone numbers require exactly 11 digits, a validation rule could be added to ensure that phone numbers are exactly 11 digits |
| Range check | The data must be within the range | A score must be between 0 and 55 marks for a prelim |
length
range
presence check
restricted choice
A range check is used here to ensure that the number entered is between 0 and 100 inclusive.
A field in a database is used to store a percentage mark for each pupil called mark.
length
range
presence check
restricted choice
If something is required, it's a presence check.
A database is used to store users' details, including an email address so that they can be contacted. The email address is required.
Balloons are available in a limited number of colours. State the type of validation that should be implemented to achieve this
1 mark
2003 Q12 (a)
The primary school has 14 different class names. For example P1A, P4B, P6/7A.
Describe how validation of this field could be implemented when the
database tables are created.
2 marks
SQP Q16 (d) (i)
| Attribute | Key | Type | Size | Required | Validation |
|---|---|---|---|---|---|
| BookISBN | PK | Text | 13 | Yes | Length = 13 |
| BookTitle | Text | ||||
| AuthorID* | FK | Number | 11 | Yes | |
| BookPublishYear | Number | 4 | Between 1900 and 2025 |
| Author |
|---|
| Attribute | Key | Type | Size | Required | Validation |
|---|---|---|---|---|---|
| AuthorID | PK | Number | 11 | Yes | |
| AuthorName | Text | 30 | Yes | ||
| AuthorDateOfBirth | Date |
| Book |
|---|
| Author |
|---|
| AuthorID |
| AuthorName |
| AuthorDateOfBirth |
| Book |
|---|
| BookISBN |
| BookTitle |
| AuthorID* |
| BookPublishYear |
writes
| AuthorID | AuthorName | AuthorDateOfBirth |
|---|---|---|
| 001 | J.R.R Tolkein | 03/01/1892 |
| 002 | J. K. Rowling | 31/07/1965 |
| BookISBN | BookTitle | AuthorID | BookPublishYear |
|---|---|---|---|
| 9780747532743 | Harry Potter And The Philosopher's Stone | 002 | 1997 |
| 0064407667 | Book the First: The Bad Beginning | 003 | 1999 |
| Author |
|---|
| AuthorID |
| AuthorName |
| AuthorDateOfBirth |
| Book |
|---|
| BookISBN |
| BookTitle |
| AuthorID* |
| BookPublishYear |
writes
| Author | ||
|---|---|---|
| AuthorID | AuthorName | AuthorDateOfBirth |
| 001 | J.R.R Tolkein | 03/01/1892 |
| 002 | J. K. Rowling | 31/07/1965 |
| Book | |||
|---|---|---|---|
| BookISBN | BookTitle | AuthorID | BookPublishYear |
| 978-0007203543 | The Fellowship of the Ring | 001 | 1954 |
| 978-0747532743 | Harry Potter And The Philosopher's Stone | 002 | 1997 |
| 978-1405266062 | Book the First: The Bad Beginning | 003 | 1999 |
A restaurant stores employee details in a database. Each employee is trained as either a chef, a server, a manager or a cleaner. Sample data from the database is shown below.
(a) Complete the missing attribute and attribute type in the table below.
2 marks
2025 Q14 (a)
| Employee | |||||
|---|---|---|---|---|---|
| empID | empName | jobTitle | startDate | fullTime | contactNum |
| 117254 | Alex Roberts | Manager | 21/10/24 | ✓ | 07701675815 |
| 259631 | Rayyan Patel | Chef | 05/09/23 | ✓ | 07778589526 |
| 300193 | Charlie King | Server | 10/03/25 | 07789900991 | |
| 220205 | Sam Scott | Cleaner | 13/02/25 | 07811606115 | |
| 576482 | Drew Moore | Cleaner | 30/12/24 | 07705900169 | |
| 365482 | Carter Price | Server | 23/01/25 | 07716168759 | |
| 419372 | Rowan Kelly | Chef | 07/07/24 | ✓ | 07700148652 |
| 895714 | Jun Baek | Server | 30/04/25 | 07812612568 | |
| 681354 | Nikan Khan | Manager | 06/08/23 | ✓ | 07780254369 |
| ... | ... | ... | ... | ... | ... |
| Attribute | Attribute Type |
|---|---|
| contactNum | |
| Boolean |
Text
fullTime
A restaurant stores employee details in a database. Each employee is trained as either a chef, a server, a manager or a cleaner. Sample data from the database is shown below.
(b) Errors are made when data is entered for new employees. State one attribute where restricted choice validation could be used to reduce errors.
1 marks
2025 Q14 (b)
| Employee | |||||
|---|---|---|---|---|---|
| empID | empName | jobTitle | startDate | fullTime | contactNum |
| 117254 | Alex Roberts | Manager | 21/10/24 | ✓ | 07701675815 |
| 259631 | Rayyan Patel | Chef | 05/09/23 | ✓ | 07778589526 |
| 300193 | Charlie King | Server | 10/03/25 | 07789900991 | |
| 220205 | Sam Scott | Cleaner | 13/02/25 | 07811606115 | |
| 576482 | Drew Moore | Cleaner | 30/12/24 | 07705900169 | |
| 365482 | Carter Price | Server | 23/01/25 | 07716168759 | |
| 419372 | Rowan Kelly | Chef | 07/07/24 | ✓ | 07700148652 |
| 895714 | Jun Baek | Server | 30/04/25 | 07812612568 | |
| 681354 | Nikan Khan | Manager | 06/08/23 | ✓ | 07780254369 |
| ... | ... | ... | ... | ... | ... |
jobTitle
| Fields | |
| Table | |
| Search Criteria | |
| Sort order |
| Fields | |
| Tables | |
| Search Criteria | |
| Sort order |
| Example 1 | |
|---|---|
| Fields | BookISBN |
| Table | Book |
| Search Criteria | BookPublishYear > 1945 |
| Sort order | BookPublishYear ASC |
Example 1:
Find all books ISBN numbers for books which were published after 1945 and order them by the publish year.
| Example 1 | |
|---|---|
| Fields | AuthorName, AuthorDateOfBirth |
| Table | Author |
| Search Criteria | AuthorDateOfBirth > 1985 |
| Sort order | AuthorName DESC |
Example 2:
Find all authors names and dates of birth who we born after 1985 and order them by their name from Z to A
| Fields | AuthorID, AuthorName, BookTitle, BookPublishYear |
| Tables | Author, Book |
| Search Criteria | Author.AuthorID = Book.AuthorID AND BookPublishYear = 1991 |
| Sort order | AuthorName ASC, BookTitle ASC |
| Author |
|---|
| AuthorID |
| AuthorName |
| AuthorDateOfBirth |
| Book |
|---|
| BookISBN |
| BookTitle |
| AuthorID* |
| BookPublishYear |
| Forename | Surname | Date of Birth | Colour | Bond Movie | Food |
|---|---|---|---|---|---|
| Karl | Fields | 19/06/2001 | Orange | Goldeneye | Tacos |
| Edward | Smith | 15/03/2001 | Orange | Goldfinger | Pizza |
| Peter | Skeldon | 16/08/2000 | Purple | Thunderball | Steak |
| Andrew | Hay | 03/02/2000 | Blue | The Living Daylights | Pizza |
Customers’ personal details have been stolen.
State one requirement of the UK General Data Protection Regulation (GDPR)
that the company should have implemented to prevent this from happening.
1 mark
2025 Q15 (c)
A property renovation company requires a relational database to store information about the tasks to be carried out on each room of a house.
The functional requirements for the database are identified:
Explain why the General Data Protection Regulations do not apply to the
information that will be stored in this database.
1 mark
2022 Q14 (b)
For six of the following words, describe what it means
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
