0% found this document useful (0 votes)
30 views2 pages

Ziead Kaddoura Database Test For Year 12 Computer Science

The document describes a relational database called WEBDATA that stores information for a social media website. It has three tables - USER, PHOTO, and TEXTPOST - to store user details and content they post. UserName is the primary key in the USER table and a foreign key in the other two tables, implementing a one-to-many relationship. Referential integrity means tables cannot reference non-existent data - a user cannot be deleted if they have associated photos. The database has been normalized to third normal form to avoid duplicate and partial dependencies between tables.

Uploaded by

Ziead Kaddoura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

Ziead Kaddoura Database Test For Year 12 Computer Science

The document describes a relational database called WEBDATA that stores information for a social media website. It has three tables - USER, PHOTO, and TEXTPOST - to store user details and content they post. UserName is the primary key in the USER table and a foreign key in the other two tables, implementing a one-to-many relationship. Referential integrity means tables cannot reference non-existent data - a user cannot be deleted if they have associated photos. The database has been normalized to third normal form to avoid duplicate and partial dependencies between tables.

Uploaded by

Ziead Kaddoura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

USER(UserName, FirstName, SecondName, DateOfBirth)

PHOTO(PhotoID, UserName, Comment, UploadDate)

TEXTPOST(PostID, UserName, DateOfPost, TheText)

(a) (i) Explain how the relationship between the tables USER and PHOTO has been implemented.

UserNAme is the primary key in USER

UserName is a foreign key in PHOTO

...........................................................................................................................................

.......................................................................................................................................[2]

(ii) Draw the entity-relationship (E-R) diagram to show the relationships between the three

tables.

[2] User

Photo
Textpost

(b) A database administrator decides to enforce referential integrity.

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).

Define the three stages of database normalisation.

1NF ............................No duplicate rows.....................................


...................................................................................................................................................

2NF ..............No partial dependencies .......................................................

...................................................................................................................................................

3NF ..................No non-key dependencies ............................................................

...................................................................................................................................................

[3]

(d) The following shows sample data from the USER table.

(i) Write an SQL script to create the USER table.

Create Table USER(

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]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy