Our site uses cookies. Some of the cookies we use are essential for parts of the site to operate and have already been set. You may delete and block all cookies from this site, but parts of the site will not work. To find out more about cookies on this website, see our Cookie Policy
Accept
© eRevision.uk and ZigZag Education 2025
This test is run by .
Note that your final mark will not be saved in the system.

Relational Databases & SQL GapFill

Target Level
4-5
Running Total
0
0%
Attempt
1 of 3

You must fill all the gaps before clicking ‘Check Answers!’

A database is defined as a “structured set of data held in a computer”, the structure being the records,  columnsdatainformationfields and tables that are used to store and organise that data. Databases are part of our everyday lives, from organising patient records in a hospital to managing the items of stock, their prices, descriptions and availability in an online store. In both examples it is important that the data held is correct and has no  inconsistentbadrejectedwrong data such as a surname which is incorrectly spelled in several different tables or  wrongincompleteincoherentredundant data such as an address stored in several different tables. This is achieved through the use of relational databases which link data in tables together using  secondaryprimarynaturaltertiary keys and foreign keys.

Example: This simple database contains three tables linked together by the primary key in the Tutor Table which becomes a  secondaryprimarypublicforeign key in the Student Table; data redundancy is further improved by using the Year Table's   secondaryforeignprimaryprivate key to link it to the Tutor table.



The whole purpose of storing data in a structured way is to make it easier to search the data and create reports. The language used to search or ‘query’ the database is  Structured Question LanguageSpecial Query LettersSpecial Question LanguageStructured Query Language (SQL).

The main keywords used to create most searches are:

  •  SELECTCHOOSEGETFIND – the fields that you want to return
  • FROM – the tables that contain those fields
  •  WHEREWHENEQUALSIF – the criteria for selecting the records
  •  ORDER BYEQUALSDETAILORGANISE – how the data is to be organised, e.g. ASC or DESC

In addition special symbols called ‘wildcards’ can also be used, for example the SQL command:

SELECT * FROM Student WHERE TutorGroup = RK... would return all the data records  students who register in GT02students in Mr Kelly’s groupfor Student IDs 515 and 377students in RK group


SQL commands can also be used to:

  • INSERT INTO new data into a table, for example:
    INSERT INTO Tutor (TutorGroup, TutorName, YearGroup, Room)  INPUTSINFOVALUESDATA (LV, Mr Vincent,Yr10,GT02)
  • DELETE FROM to delete data from the table, for example:
    DELETE FROM Student WHERE StudentID = 573
  • UPDATE data in a table, for example:
    UPDATE Tutor  CREATESETFINDGET Room = GT05 WHERE TutorGroup = CC

Data can also be found from more than one table by specifying the link between them, in order to find both the student record and the relevant tutor name and registration room the SQL search would be extended:

SELECT FirstName, Surname, TutorName, Room FROM Student, Tutor WHERE Student.TutorGroup = Tutor. TutorGroup AND TutorGroup = RK

This is your 1st attempt! You get 3 marks for each one you get right. Good luck!

Pass Mark
72%