8. Databases
A section of Computer Science, 9618
Listing 10 of 12 questions
9618_s22_qp_12
THEORY
2022
Paper 1, Variant 2
9618_s23_qp_13
THEORY
2023
Paper 1, Variant 3
An organisation uses a database to store data about the types of bird that people have seen. The database is managed using a Database Management System (DBMS). State what is meant by a data dictionary and give one example of an item typically found in a data dictionary. Definition Example State what is meant by data integrity and give one example of how this is implemented in a database. Definition Example The database, Birds, stores information about the types of bird and the people who have seen them. Data about each bird seen is stored with its location and data about the person who saw the bird. Database Birds has the following tables: BIRD_TYPE(BirdID, Name, Size) BIRD_SEEN(SeenID, BirdID, Date, Location, PersonID) PERSON(PersonID, FirstName, LastName, EmailAddress) Complete the table by identifying two foreign keys and the database table where each is found. Foreign key Database table The database Birds has been normalised. Draw one line from each Normal Form to the most appropriate definition. Normal Form Definition All fields are fully dependent on the primary key. There are no repeating groups of attributes. There are no partial dependencies. First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF) Part of the database table BIRD_TYPE is shown: BirdID Name Size Blackbird Medium Jay Large Raven Large Robin Small The database only supports these data types: • character • varchar • Boolean • integer • real • date • time Write a Structured Query Language (SQL) script to define the table Bird_Type. The database tables are repeated here for reference: BIRD_TYPE(BirdID, Name, Size) BIRD_SEEN(SeenID, BirdID, Date, Location, PersonID) PERSON(PersonID, FirstName, LastName, EmailAddress) Complete the SQL script to return the number of birds of each size seen by the person with the ID of J_123. SELECT BIRD_TYPE.Size, (BIRD_TYPE.BirdID) AS NumberOfBirds FROM BIRD_TYPE, WHERE = "J_123" AND BIRD_TYPE.BirdID = BIRD_TYPE.Size;
9618_s23_qp_11
THEORY
2023
Paper 1, Variant 1
A shop sells plants to customers. The shop manager has a relational database to keep track of the sales. The database, PLANTSALES, has the following structure: PLANT(PlantName, QuantityInStock, Cost) CUSTOMER(CustomerID, FirstName, LastName, Address, Email) PURCHASE(PurchaseID, CustomerID) PURCHASE_ITEM(PurchaseID, PlantName, Quantity) The database is normalised. The table lists the following three stages of normalisation: • The first stage is from a database that is not normalised (0NF) to First Normal Form (1NF). • The second stage is from 1NF to Second Normal Form (2NF). • The third stage is from 2NF to Third Normal Form (3NF). Tick () one box in each row to identify the appropriate stage for each task. Task Normalisation stage 0NF to 1NF 1NF to 2NF 2NF to 3NF Remove any partial key dependencies Remove any repeating groups of attributes Remove any non-key dependencies Draw an entity-relationship (E-R) diagram for the database PLANTSALES. PLANT PURCHASE_ITEM PURCHASE CUSTOMER The shop manager uses a Database Management System (DBMS). Describe the purpose and contents of the data dictionary in the DBMS. The shop manager uses both Data Definition Language (DDL) and Data Manipulation Language (DML) statements to create and search the database. Complete the DML statements to return the total number of items purchased with the purchase ID of 3011A. SELECT SUM( ) FROM WHERE = ; Write DDL statements to include a field in the table PURCHASE to store the date of the order.
9618_w21_qp_12
THEORY
2021
Paper 1, Variant 2
A horse riding school uses a database, Lessons, to store data about lesson bookings. This database is created and managed using a Database Management System (DBMS). The table contains names and descriptions of DBMS features and tools. Complete the table by writing down the missing names and descriptions. Name Description Data dictionary Query processor A model of a database that is not specific to one DBMS. A software tool that allows the user to create items such as tables, forms and reports. Explain the reasons why referential integrity is important in a database. The database Lessons has the following tables: HORSE(HorseID, Name, Height, Age, HorseLevel) STUDENT(StudentID, FirstName, LastName, RiderLevel, PreferredHorseID) LESSON(LessonID, Date, Time, StudentID, HorseID, LessonContent) Dates in this database are stored in the format #DD/MM/YYYY#. The fields RiderLevel and HorseLevel can only have the values: Beginner, Intermediate or Advanced. Describe two methods of validating the field RiderLevel. Write a Structured Query Language (SQL) script to return the names of all the horses that have the horse level intermediate or beginner. The following SQL script should return the number of riders that have the rider level beginner and have a lesson booked on 09/09/2023. SELECT SUM(STUDENT.RiderLevel) AS NumberOfRiders FROM STUDENT, LESSON WHERE StudentID = StudentID OR Date = #09/09/2023# AND STUDENT.RiderLevel = Beginner; There are four errors in the script. Identify and correct each error.
9618_s23_qp_12
THEORY
2023
Paper 1, Variant 2
Questions Discovered
12