G.C.E ORDINARY LEVEL PASTPAPER CHAPTER IX SECTION II | DATABASE OL 2021 01. Which of the following statements are correct regarding relational database? A - A record is a collection of fields. B - A table is a collection of records. C - A relational database is a collection of tables. a. A and B only b. A and C only c. B and C only d. All A, B and C • Questions 02 to 04 are based on the following partly shown database tables that are used to store data about students, subjects and enrollment details in a school. Student Subject Student_ID Student_Name Subject_ID Subject_Name Teacher_Name 1001 Ayisha S001 Chemistry Perera 1002 Asma S002 Physics Selvam 1003 Amra S003 Combined Maths Nazwar 1004 Bisra S004 Geography Silva S005 Political Science Almeida Enroll Student_ID 1001 1005 1003 1001 Subject_ID S002 S001 S002 S003 Date 04/01/2022 05/01/2022 09/01/2022 04/01/2022 02. What would be the primary key of the Enroll table? (1) Student_ID (2) Subject_ID (3) Subject_ID + Date (4) Student_ID + Subject_ID 03. What would be a foreign key in the database? (1) Subject_ID in the Subject table (2) Student_ID in the Student table (3) Date in the Enroll table (4) Subject_ID in the Enroll table 04. Shane dropped the “Geography” subject and enrolled for the “Political Science” subject. Which table/tables needs/need to be updated for this purpose? (1) Subject table (3) Enroll table (2) Subject table and Enroll table (4) Student table, Subject table and Enroll table 05. Following are the partly shown database tables that are used to store details about food items purchases and suppliers of a school canteen. The canteen sells food items which are purchased from the suppliers. Table: Item (Contains data of the items available in the canteen with their selling prices in Rupees) Item_ID Item_Name Selling_Price F001 Tea bun 40 F002 Fish roll 70 F003 Chicken roll 65 F004 Vegetable roll 60 DATABASE IX | RIYAS RUSHARD 17 Table: Purchase (Contains data of the purchasing prices of items from different suppliers. Note that a particular food item can be purchased from many suppliers for different prices) Item_ID Supplier_ID Purchasing_Price F001 S007 30 F002 S004 35 F003 S001 60 F004 S004 55 Table: Supplier (Contains data about suppliers) Supplier_ID Supplier_Name Supplier_Location S001 Saman Maradana S002 Raj Borella S003 Sharaf Dematagoda S004 Shane Maradana (1) (a) Write down the primary key of the Purchase table. (b) Write down the foreign keys in the Purchase table. (2) Which tables need to be updated to accommodate the following? (a) The supplier S004 changes his location (Supplier Location) to Rajagiriya. (b) The canteen decides to increase the selling price of a fish roll to 80 Rupees due to 10 Rupee price increase by the supplier. (3) A new supplier Kamal (Supplier_ID: S008) from Wellawatte starts supplying vegetable rolls to the school canteen for 50 rupees. Write down the new record(s) to be added to the relevant table(s) for the above change. Use the tablename → (field1. field2, ...) format for each new record. (4) What are the appropriate tables to be joined to write a query to find the names of the suppliers who supply fish rolls to the canteen? DATABASE IX | RIYAS RUSHARD 18 OL 2020 • Questions 1 to 2 are based on the following database tables that are used to store data about authors, books, and the books written by authors. Table: Author Table: Book Table: Author_Book 01. What would be the primary key of Author_Book table? a. AuthorID c. AuthorID + BookID b. BookID d. AuthorID + Royalty_Share 02. Consider the following statements: A – AuthorID in the Author table is a foreign key B – AuthorID in the Author_Book table is a foreign key C – BookID in the Book table is a primary key Which of the above statements are correct? a. A and B only c. B and C only b. A and C only d. All A, B and C 03. Who is the author of the book titled "Mathematics with Fun"? a. Anil Ratnayake c. Sharaf Khan b. Indika Serasinghe d. Lalith Wijenayake Part II 04. Consider the partly shown Purchase database table listing the purchase date and quantities of different items purchased by different suppliers: DATABASE IX | RIYAS RUSHARD 19 i. Write down the number of fields and records in the above table. ii. Write down the most suitable data types for PurchaseDate and Quantity. 05. Following are the partly shown relational database tables that are used to store information about supervisors, projects, and the projects supervised by supervisors in a University. Table: Supervisor Table: Project i. Table: Supervisor_Project State whether the following statements are TRUE or FALSE. a. SupervisorID is a foreign key of Supervisor_Project table. b. ProjectID is the primary key of Supervisor_Project table. ii. Which table(s) need(s) to be updated to accommodate the following changes? a. Anura Wijenayake is assigned as a Supervisor for the project P002 with an allowance of 10,000. b. A new supervisor, Pradeep Dissanayake (SupervisorID: S06) joined the Department of Chemistry and was assigned as a supervisor for an ongoing project (ProjectID: P003) with an allowance of 15,000. iii. On 15/09/2020, the University started a new project (ProjectID: P006) with Mohamed Nazwar and Raj Selvam as supervisors. An amount of 11,000 is allocated for each supervisor. Write down the new record(s) to be added to the relevant table(s) for the above change. Use the format tablename iv. (field], field2, ..) for each record. What are the most appropriate tables to be joined to write a query to find the Department name(s) of the supervisor(s) who supervise(s) the project P001? DATABASE IX | RIYAS RUSHARD 20 OL 2019 • Questions 4 to 7 are based on the following partly shown database tables that are used to store data about books, students, and books reserved by students in a school library. Table: Book (Contains the details of books and whether each book is reserved or not) Table: Student (Contains details of all students in school and whether each student is a library member or not) Table: Reservation (Contains details about books reserved by students) 01. How many fields are in the student table? a. 2 b. 3 c. 4 d. 5 02. What would be an example of a foreign key in the database? a. Book_ID in Reservation table b. Grade in Student table c. Reserved_Date in Reservation table d. Title in Book table 03. What is the title of the book reserved by Kumar? a. Classic Short Stories c. Poem Writing b. Effective Writing d. Vocal Theory 04. A student gets the library membership and reserves a book. What tables need to be updated for this purpose? a. Book table and Reservation table b. Book table and Student table c. Reservation table and Student table d. Book table, Reservation table and Student table DATABASE IX | RIYAS RUSHARD 21 Part II 05. Following are the partly shown tables of the relational database of a sports team management system in a school. Table: Player (Includes the descriptions Table: Player_Team (Contains the players of of players) each team and their years of joining) Table: Team (Contains the names and age categories of teams and their captains) (Note: CaptainID is a valid PlayerID) a. i. Write down the primary key of the Team table. ii. Write down the possible primary keys available in the Player table. b. Which table(s) need(s) to be updated to accommodate the following changes? i. A new student, Piyal Alwis (StudentID: S4205), is admitted to the school and joins the U17 Cricket team in 2019. ii. Nimal Fernando is appointed the captain of the U19 Volleyball team. i. Write down the new record(s) to be added to the relevant table(s) for the change c. mentioned in part (ii) (a). ii. Use the format: tablename (field1, field2, ...) for each record. (Note: Assume that Piyal Alwis is assigned the PlayerID P1120) iii. In 2019, the school starts an Under 17 (U17) Football team (TeamID: T7) and appoints Shane Almaida as the captain. Write down the new record(s) to be added to the relevant table(s) for the above change. iv. Use the format: tablename (field1, field2, ...) for each record. (Note that Shane Almaida is currently playing in the U17 Cricket team.) d. Which tables are to be joined to write a query to find the name of the U19 Cricket captain? DATABASE IX | RIYAS RUSHARD 22 OL 2018 ISBN BookID BookName PublisherID Edition 98123455 2304 ICT forLife 6 2 98123456 2305 ICT for Life 6 2 98123457 2306 Database System 2 4 01. What is a suitable field for the primary key? a. BookID b. BookName c. ISBN d. PublisherID c. Edition d. PublisherID 02. What is a suitable field for the Foreign Key? a. BookID b. BookName Marks Table Subject Table Admission_No Subject_Code Marks Subject_Code Subject_Name 1111 80 89 80 ICT 1112 33 69 33 History 1113 34 72 34 Science 1111 33 78 03. Which of the following id incorrect regarding the Marks and Subjects tables? a. Admission_No and Subject_No in Marks Table is Composite Key b. Admission_No is a Primary Key in Marks Table c. Subjct_Code is a Foreign Key in Marks Table d. There is a one-to-many Relationship between Subjects table and Marks Table Part B 04. Consider the Employee and Division Tables given below. Employee Table Emp_Name Emp_ID Designation Nadha E1 Manager Hana E2 Engineer Nisma E3 ICT Officer Mariyam E4 Accountant Div_ID Division Table i. Division_Name Division_Number Division_Location Finance 1 Col 1 Stores 2 Col 2 Sales 3 Col 3 Assume that a new Division name IT located in Col 3 to be added. Write down the new record that has to be added and the corresponding table name. ii. Nadha and Hana works at the Stores. Nisma works at the Finance Division. Mariyam recently joined the IT division. Write down the value and fill the above table. DATABASE IX | RIYAS RUSHARD 23 OL 2017 Student Table Marks Table DOB Name Student_No Class Sub_Code Student_No Marks 20-11-95 Afham 1001 1A 01 1001 85 17-12-95 Himaya 1002 1A 02 1001 80 21-10-95 Hima 1003 1A 01 1002 65 18-12-95 Zuha 1004 1B 03 1003 70 Subject Table Sub_Code Subject 01 Sinhala 02 Art 03 English 01. How many fields are in the subject table? a. 2 b. 3 c. 4 d. 6 02. What would be the most suitable field as the primary key for the Student Table? a. Student_No c. Name b. BOD d. Class 03. What would be an example for a foreign key in the database? a. Sub_Code in Subject Table c. Marks in Marks Table b. Sub_Code in Marks Table d. DOB in Student Table 04. How many marks did Kapila obtain for English? a. 65 c. b. 70 d. 85 80 05. Consider the following statements related to database software: A - A Collection of fields related to one object is called a record B - A collection of related tables is called a database C - A Foreign key of one table is the primary key of another table Which of the above statements are correct? a. A and B c. B and C b. A and C d. All above DATABASE IX | RIYAS RUSHARD 24