8.3. Data Definition Language (DDL) and Data Manipulation Language (DML)
A subsection of Computer Science, 9618, through 8. Databases
Listing 6 of 6 questions
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
6