Ziead Kaddoura Database Test For Year 12 Computer Science
Ziead Kaddoura Database Test For Year 12 Computer Science
A social media website has a relational database, WEBDATA, that stores the site’s information.
The database has three tables to store users’ details, and details of the images and text that they
post.
(a) (i) Explain how the relationship between the tables USER and PHOTO has been implemented.
...........................................................................................................................................
.......................................................................................................................................[2]
(ii) Draw the entity-relationship (E-R) diagram to show the relationships between the three
tables.
[2] User
Photo
Textpost
Use an example from the database WEBDATA to explain what is meant by referential
integrity.
Referential integrity is when tables do not try to reference data which does not exist, a primary key
cannot be deleted unless all dependant files are already deleted and an example of this is a
UserName cannot be deleted from the User table if they have a related photo
...............................................................................................................................................[3]
(c) The database has been normalised to Third Normal Form (3NF).
...................................................................................................................................................
...................................................................................................................................................
[3]
(d) The following shows sample data from the USER table.
UserName
FirstName
SecondName
DateOfBirth
);
...........................................................................................................................................
.......................................................................................................................................[5]
(ii) The database administrator needs to alter the USER table. A new field, Country, needs
to be added.
Write an SQL script to add the field Country to the USER table.
...........................................................................................................................................
.......................................................................................................................................[2]