Loading…
Loading…
Loading…
AQA GCSE Computer Science · 8525
AQA 8525 Check the specification (PDF) (opens in a new tab)
A relational database organises data into tables which can be linked using matching key values. Each table stores information about a particular kind of thing, such as students, tests or test results.
A table has rows and columns. A record is a row containing related information about one item. A field is a named column holding a particular kind of information, such as FirstName or TestScore. These give the data a clear structure: a student's first name and last name have separate, labelled places.
Suppose a school needs to store students' details and their test results. If it puts everything into one table, it may repeat a student's name and date of birth every time that student takes a test. Repeated entries can become inconsistent: a name might be entered in the wrong order, or a date might be entered differently.
Instead, the school can organise its relational database into three tables:
This separates a student's details from their individual results. The student's details can be stored once, while several results link back to that student. It reduces unnecessary repetition and means those details do not have to be changed separately in every result record.
Separating information is only useful if the database can connect it again. A primary key uniquely identifies a record in a table. In the Student table, StudentID identifies a particular student; in the Test table, TestID identifies a particular test. Names are less suitable for identifying students because different students can share a name.
A foreign key refers to a primary key in another table. In StudentTest, StudentID links a result to the correct student, while TestID links it to the correct test.
Each result links to its student and its test through matching identifiers.
The links depend on matching values. A result's StudentID must match the StudentID of the student who earned that result. Its TestID must match the identifier of the test they took. Merely giving columns the same name does not connect their records.
Several result records can contain the same student identifier because one student can take several tests. Similarly, several results can refer to the same test because several students can take it.
Using these links, the database can retrieve information from several tables together. For example, it can combine a student's first and last names from Student, their score from StudentTest, and the subject and maximum mark from Test.
The information remains organised in separate tables, but the matching keys allow it to be used together. That combination of structured tables and links between related records is the central idea of a relational database.
A relational database organises data into tables linked using matching key values.
Student.StudentID links to StudentTest.StudentID.Test.TestID links to StudentTest.TestID.Store details separately to reduce unnecessary repetition and inconsistent copies. Use the links to retrieve related information from several tables together.
When explaining a relational database, include both tables and the links between them; ‘a database stores data’ is not enough.
Explain a link using matching key values, not just fields with the same name.
A foreign key can appear in several records: this allows several test results to link to the same student.
It can see this note and what your specification asks for.
Answers are free with an account.
1 free note left this week
Get more free notesYour answer sets when this note comes back for review, or marks it complete.
Was this note helpful?
Log in to tell us whether it helped, or to report a problem.
Last updated
Relational database
A database that organises data into tables which can be linked using matching key values.
Primary key
A field, or combination of fields, that uniquely identifies each record in a table.
Foreign key
A field in one table that refers to the primary key of another table, allowing related records to be linked.
Put your knowledge into practice — try past paper questions for Computer Science
Relational database
A database that organises data into tables which can be linked using matching key values.
Primary key
A field, or combination of fields, that uniquely identifies each record in a table.
Foreign key
A field in one table that refers to the primary key of another table, allowing related records to be linked.