You are on page 1of 38
Ad HE) +1. Office Use On! Sect 1Q5 [Sect It 28 Section! [Sect Qi | Sect 11Q2 | Sect 1 Q3- Ao eS As fay ee fat ae Monash Univer: | lll ry “ 004124. : Semester Two Examination Periéd 2010 oe Faculty of Information Technology EXAM CODES: FIT1004 TITLE OF PAPER: Database EXAM DURATION: 3 hours writing time READING TIME: 10 minutes THIS PAPER IS FOR STUDENTS STUDYING AT:( tick where applicable) Berwick 2 Clayton = Malaysia 1] Off Campus Learning 1 Open Learning Gl Caulfield (Gippsland 1 Peninsula 1 Enhancement Studies I Sth Africa O Pharmacy 0 Other (specify) During an exam, you must not have in your possession, a book, notes, paper, electronic device/s, calculator, pencil case, mobile phone or other material/tem which has not been authorised for the ‘exam or specifically permitted as noted below. Any material or item on your desk, chair or person will be deemed to be in your possession. You are reminded that possession of unauthorised materials in an ‘exam isa discipline offence under Monash Statute 4.1. : No examination papers are to be removed from the room. Attempt all questions. All answers must be printed neatly on this paper. Answer questions with concisely expressed factual information. The backs of pages in this paper may be used for any rough work, Any material written on the backs of pages will not normally be corrected. If an answer needs to overflow from its designated answer space to a blank page, clearly indicate that this is the ‘case and that the material on the blank page is for correction, This paper must be handed up at the end of the examination, even if no questions are attempted, The marks for each question are shown, Total ‘marks for the examination: 100. This exam counts as 60% of the final assessment for the AUTHORISED MATERIALS. CALCULATORS: O YEs No OPEN BOOK O yes No SPECIFICALLY PERMIT” 33 > Dyes BNO Candidates must complete this section STUDENT ID DESK NUMBER Page | of 38 ‘This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written ‘material on this page should be included in the answer. Page 2 of 38 Section A: Multiple Choice Section This section is worth 10 marks. Each question is worth 0.5 mark. Mark your selection by placing a ¥ or a X through your selected answer ~ for example © oF 3K If you change your selection during the review of your paper, prior to the end of the Examination, make sure that the alteration is clear. Note: There is only ONE correct answer for each question. L.A relatior not in INF if__. a, ithas multiple candidate keys: b. all of the key attributes are defined c. there are repeating groups in the table d. all atributes are dependent on the primary key 2. No data entry at all, for an attribute value, is known as a(n) a. oil b. null c. empty d. zero 3. The information stored in the ___ is used by the DBMS for a recovery requirement triggered by 4 ROLLBACK statement, a program’s abnormal termination, or a system failure such as a network discrepancy or a disk crash. data dictionary metadata rollback manager |. transaction log 4, The ERD is used to graphically represent the __ database model. condensed physical logical ‘conceptual 5. The following, ___, might be represented with a single-valued attribute. Person’s phone number(s) Car’s color Employee's educational background Person’s social security number eese 6. A derived attribute ‘must be stored physically within the database need not be physically stored within the database has many values must be based on the value of three or more attributes aeoe Page 3 of 38 ‘This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written ‘material on this page should be included in the answer. Page 4 of 38 10. 13. ‘The ___ type of attribute cannot be created in a DBMS. a. derived b. multivalued c. simple 4. composite exists when different versions of the same data appear in different places. a. Data inconsistency b. Data consistency ¢. Better data integration . Improved decision making A ____ lock allows concurrent transactions to access different rows of the same table. a. database-level b. table-level ©. page-level 4. row-level Attributes may share a___- a. name b. domain c. location d. table Students and classes have a___ relationship. one-to-one b. one-to-many &.-many-to-one many-to-many In the context of a database table, the statement “A__B” indicates that if you know the value of attribute A, you can look up the value of attribute B. a. conti b. is related to ©. owns d. determines As long as two transactions, T] and 72, access __data, there is no conflict, and the order of execution is irrelevant to the final outcome. shared common unrelated locked Page 5 of 38 This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written material on this page should be included in the answer. Page 6 of 38 4 20. are important to ensure data integrity. Attributes Entities Relationships Constraints pege . A____isany key that uniquely identifies each row, superkey special selective candidate eese relates to the activities that make the database perform more efficiently in terms of storage and access speed. Performance tuning Database design Query access Database management aege Al primary key entries are unique, and no part of a primary key may be _. zero a foreign key null a candidate key aege ‘The most likely data type for a surrogate key is. a. Character b. Date ©, Logical 4. Numeric The rel al database model enables you to view data __ rather than a, relationally, hierarchically . hierarchically, retationally physically, logically d. logically, physically Given the table EMP_PROJ (PROJ_NUM, EMP_NUM, PROJ_NAME, EMP_NAME, JOB_CLASS, CHG_HOURS, HOURS), of the following, is a partial dependency. a. PROJ_NUM --> PROJ_NAME b. JOB_CLASS -> CHG_HOUR ¢. PROJ_NUM, EMP_NUM ~> HOURS 4, PROJ_NUM, EMP_NUM ~-> CHG_HOURS. [20 x 0.5 = 10 marks} Page 7 of 38 This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written ‘material on this page should be included in the answer. Page 8 of 38 Section B: Question 1 The Rel: Sample data from the StoreCo database is shown below. Short Answer Section This section is worth 90 marks. nal Model ‘many employees, one of whom manages the store: Table name: EMPLOYEE (15 marks) ‘You should note that each store employs Database name: Ch03_StoreCo Ewr_CODE [EMP TITLE | EMP_UNAME_[ EMP FNAME | EMP INITIAL | EMP_DOB [STORE CODE 1 Mr, Williamson | John Ww 21-May-64 [3 2 Ms: Ratula ‘Nang o9-Feb-69 [2 3 Ms: Greenboro | Lottie R o2-Oct-61 [4 4 Mrs Rumpersfro | Jennie s OldJune-71 [5 3 Mr ‘Smith Robert L 23-Nov-59 [3 6 Mr Renselaer__[ Cary A 25-Dec-65_[ 1 7 Mr Ogallo Roberto s 31-Jul-62 [3 8 Ms: Johnsson | Elizabeth [1 10-Sep-68 [1 9 Mr Bindsmar | Jack Ww 19-Apr-55 [2 10 Mrs Jones: Rose R ‘06-Mar-66 | 4 HW Mr Broderick | Tom 21-Oct-72 [3 12 Mr Washington Alan ¥ ‘08-Sep-74_[2 13 Mr Smi Peter N 25-Aug-64 [3 14 Ms Smit Sherry H 25-May-66 [4 15 Mr Olenkt Howard U 25-May-64 | 5 16 Mr Archialo | Barry Vv 03-Sep-60 [5 17 Ms Grimaldo | Jeanine K 12-Nov-70 [4 18 Mr Rosenberg | Andrew D 24-Jan-71 [4 19 Mr Rosten Peter F 03-0c1-68_ | 4 20 Mr McKee: Robert Ss 06-Mar-70 [1 21 Ms ‘Baumann | Jennifer A UDec-74_ [3 Table name: STORE, ‘STORE CODE [STORE NAME | STORE YTD SALES | REGION CODE | EMP_CODE L Access Junction | 1003455.76 2 8 2 Database Comer | 1421987.39 2 12 3 Tuple Charge 986783.22 1 7 4 Attribute All 944568.56 2 3 3 Primary Key Point | 2930098.45 1 15 ‘Table name: REGION REGION CODE | REGION DESCRIPT. 1 East 7 2 West Diagram from Coronel, Morris, & Rob, Database Systems: Design, Implementation & Management, Ninth Edition 2011, Course Technology Cengage Learning Page 9 of 38 ‘This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written material on this page should be included in the answer. Page 10 of 38 (@) Using this sample data, answer the following questions: @ ) Git) (iv) ™ ‘What is the primary key of the EMPLOYEE table? Does the EMPLOYEE table exhibit entity integrity? Explain your answer. What, if any, foreign key/s does the EMPLOYEE table contain? Does the EMPLOYEE table exhibit referential integrity? Explain your answer. Create an ERD to show the relationships among EMPLOYEE, STORE and REGION (your entities need only contain primary key attributes). [141541415 +2 =7 marks) Page 11 of 38 ‘This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written ‘material on this page should be included in the answer. Page 12 of 38 (0) Write the Relational Algebra statements, using IRA commands, to produce the following information: (@) List the employce title, first name, last name and date of birth for all employees Gi) List the full details for all employees who have a last name of "Si (iii) List the full details for all employees who work in the "Attribute Alley" store. iv) List the first name, last name and initial for all employees who work in the "East" region (your answer must show an understanding of efficiency considerations). [1+ 1+2+4=8 marks} Page 13 of 38 ‘This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written material on this page should be included in the answer. Page 14 of 38 Question 2 Entity Relationship Modelling (15 marks) Scientific Research publication The usual way of reporting scientific discoveries is by publishing articles in journals. Most scientific Journals today are owned and distributed by large publishing houses. These publishers usually ‘maintain several journals to make efficient use of their facilities. A journal is published periodically as a series of volumes, with a single volume being published each year. Publishers index joumnals using an 8 digit number, known as the ISSN. Each volume of a journal consists of articles. These articles may be of several types, including reports of scientific results, and reviews that summarize the state of knowledge about a topic. Articles are cited by: the name of the author(s), the year, the journal name, the volume number, and the first and last page numbers that it occupies within the volume. For ¢xamp ‘Shuming Nie, Yun Xing, Gloria J. Kim, and Jonathan W. Simons (2007). Nanotechnology applications in cancer. Annual Review of Biomedical Engineering Volume 9: pages 257-288. Researchers play a part in all the main activities of journals. An individual researcher may play any (or all) of three different roles for a research journal: 1. Editor of a journal; 2. Author of article(s) that are submitted to journals for publication; 3. Reviewer of submitted article(s), Each journal has one or more editors, When an author (or authors) submits an article for publication in a journal, the editor assigns a submission number to the article and sends copies of it to one o more researchers who act as reviewers. Each reviewer writes a report about the article and sends the report back to the editor. Based on these reports, the editor decides whether to accept the article for Publication and advises the author(s) of the decision. Accepted articles then go to press and appear in a volume of the journal. In addition there is a need to keep track of how many articles each editor is managing and how many articles each researcher has reviewed. Create a Conceptual Entity-Retationship (ER) diagram to represent the data requirements described above for a database of research publishing. + Clearly state any assumptions you make when creating the ER model. + Besure to include all necessary attributes, including Primary Keys, as part of your ER design. * You should also name all relationships. (15 marks] Page 15 of 38 ‘This page may be used for any rough work. Material written on this page will material on this page should be Page 16 of 38 Page 17 of 38 This page may be used for any rough work, Material written on this page will not be corrected unless there is a clear indication that written ‘material on this page should be included in the answer. Page 18 of 38 Question 3 Logical Mode! and the SQL Create Table Statement (10 marks) {a) A dating agency wishes to match couples on the basis of interests they share'in common, These interests might include activities such as dining, photography, dancing etc. A conceptual ER model of the problem is shown below: BERSON. fpafzan id PRT person_name person_eddress person phone [person_s6x ‘The agency also wishes to record the number of years a person has been involved 4 particular interest as well as their personal rank for the interest (rank will be a number from I, 2, 3, 4, 5 where 1 is a major interest for the person and 5 is minor interest), Convert the conceptual ERD above wishes to record, 10 a logical model, including the extra items which the agency {5 marks} Page 19 of 38 Material written on this page will not be corrected unless there is a clear indication that written on this page should be included in the answer. Page 20 of 38 (0) Using the logical model you designed for part (a), write the SQL statements needed to create the table that contains the attributes "number of years” and "personal rank". Your schema should include a primary key definition, as well as appropriate referential integrity references and at least one example of a column check and a named constraint. [5 marks] Page 21 of 38 This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written ‘material on this page should be included in the answer. Page 22 of 38 Question 4 Normalisation (10 marks) ‘The Best Food restaurant offers a unique gastronomic experience for it's diners. Unlike other restaurants, they do not provide an a /a carte option for customers. Best Food provides a set course ‘menu with a fixed price called degustation. Customers can choose to attend a lunch or dinner degustation, Apart from degustation, the restaurant also offers a master cooking class with the head chef Mr Jamie Oliver. Each of the event types, such as lunch or evening degustation or master class, will have a Best Food emptoyee in charge. This person in charge ensures that the customer will be notified when a change needs to be made to the booking. The information regarding the booking is ‘kept in a booking book. When a customer request a booking, they will be required to tell the restaurant their name, the type of the event to be booked, the date and time of the booking, their contact number and the total number of people in the booking. Examples of the booking entry are shown by the table below: Date Time [Customer | Contact Number ] Event Person in charge | Total | Price Name Persons 12-Aug-10 [12.30 [Maria [04222223333 | Lunch | Dora Smith 6 60 PM__| Indrawan 12-Aug-10 {12.30 | John 04113333333 | Master | Simon Becket 1 120 PM__| Smith Class 12-Aug-10 [7.00 | Mary Joe | 95671290 Dinner | Linda Dee 2 150 PM 13-Aug-10 | 12.30 | Lindsay [99031001 Lunch | Dora Smith 4 60 PM__| Smith 13-Aug-10 | 12.30 | Sunshine | 99021900 Lunch | Dora Smith 2 60 PM_| Dee (@) Write a relation depicting the above table in first normal form (INF), and identify the PRIMARY KEY of this relation. Name this relation BOOKING. (b) Draw a dependency diagram for the BOOKING relation. You should show all dependencies which exist, and label the types of dependencies. Page 23 of 38 ze may be used for any rough work. written on this page will not be corrected unless there is a clear indication that written material on this page should be included in the answer. Page 24 of 38 © Normalize the BOOKING relation so that it will be in 2NF: 2NE () Normalize your answer to (c) above so it will be in NF: 3NE [1434541 = 10 marks} Page 25 of 38 This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear i it a this page should be included in the answer. Page 26 of 38 Question 5 SQL 0 marks) ‘Appendix A shows the logical model for the Monash DVD Rentals (MDR) system and the Oracle schema file which can be run to create the full database structure. Using SQL, write the commands to achieve the following results on this MDR database: a) List the rental id and member number for every rental in rental id order. “b) List all the distinct cities where all members come from, order by city in descending order. ©) List the id and title of every mor whose rating code is PG. 4d) List all movie titles which contain the word ‘jaws’. Page 27 of 38 This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written material on this page should be included in the answer. Page 28 of 38 €) List the copy id and the number of times it was rented for every copy which has been rented more than 10 times and the copy is in stock. £) For every movie made by Time Warner (studio id = 20), list the movie title and genre id. 8) Display the details of all movies - the movie title, movie release date, rating details, and studio id in one column called "Movie Det ‘h) Find out how many movies are from the Time Warner studio (you may directly use the information that Time Warner is studio_id = 20). Page 29 of 38 ‘This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written material on this page should be included in the answer. Page 30 of 38 ’) Calculate the average copy_purchase_price for each movie J) Find the family name and the given name of all members who have not rented any movies since 01-Jan-2010. k) Increment by one, the number of times the movie copy, identified by copy_id = 12345, has been rented, 1) Delete every rental where the copy rented is no longer in stock (copy_instock m) Insert the details of a new copy of movie id = 123456 which was purchased today with the maximum price it was previously bought. The new copy has a copy id = 98765. (142424 14242434243444243+3 =30 marks] Page 31 of 38 ‘This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written material on this page should be included in the answer. Page 32 of 38 Question 6 Transaction Management (@) The following schedule represents a sequence of events in an interleaved execution of set of transactions (T1,12,13,74,T5) which are manipulating data items (A,B,C,D): Time Transaction o TT t 12 2 73 3 TI 4 73 5 12 6 12 7 2 8 14 9 72 10 TS TS 2 TS ‘Assume that a READ acquires an $ lock and an UPDATE acquires an X lock or promotes an S Action READA READ B. READ A. UPDATE A READC READ C UPDATE B READ A UPDATE D UPDATE C READB READ C. READ D (10 marks) lock to an X lock. Assume that no locks are released during the execution of these events. j) Draw a wait-for graph to show which transactions are waiting for which transactions after these events have executed. ii) Is deadlock present? Explain your answer. Page 33 of 38 ‘This page may be used for any rough work. Material written on this page will not be corrected unless there is a clear indication that written material on this page should be included in the answer. Page 34 of 38 (®) Individual transactions are required to display four properties, often referred to as the ACID test. Describe each of these properties. [6 +4= 10 marks] END OF EXAMINATION QUESTIONS APPENDIX A FOL! Page 35 of 38 Appendix A: MONASH-DVD RENTALS (MDR) Database ee z @ renter 7 aL a | [9 member gn \Yrrtd | barioved Aa 6 Voor Jo member frame makes |e rent cate (9 copy pacha prea lo merbor_stoat Heo rent _duo dato "9 copy_purchwsa date lo menbeccty 4 uc” ]O rent yetum date |< © copy_tines. sorted | member stato Bh locos | dx |} copy valle {@ member_postcoda 1 member_no (FK) + 1@ Copy_nstock 1@ member_phane [9 moe dF) | member jondate + 'SALGRADE’ : "STUDIO" 1 Unique identifier for studio (PK) + Studio Name CREATE TABLE sTUDI0 atudio id MOMBER(S) WOT NULL , studio name VARCHAR(40) NOT NULL CONSTRAINT studio pk PRIMARY KEY (studio_id)); - Create Table - rating_code - rating desc - rating_details “RATING? Unique identifier for rating (PK) Description of rating Extended details of rating CREATE TABLE RATING ( rating_code VARCHAR(S) NOT NULL , rating_desc VARCHAR(100) NOT NULL , rating details VARCHAR(100) NOT NULL, CONSTRAINT rating_pk PRIMARY KEY (rating code)); Page 36 of 38 ++ movie running time create Table genre_id genre_description "GENRE! Unique identifier for genre (PK) Genre description CREATE TABLE GENRE ( genre_id CHAR(2) NOT NULL , genre_description VARCHAR(20) NOT NULL, CONSTRAINT genre_pk PRIMARY KEY (genre_id)); create Table member_no menber_gname member_fname member_street member_city member_state “MEMBER: Unique identifier for member (PK) Member given name Member family name Member address - street Member address - city Member address - state member postcode: Member address - postcode member phone : Member phone (null allowed) member_joindate : Date member joined MonashDvo CREATE TABLE MEMBER ( member_no NUMBER(5) NOT NULL , member gname VARCHAR(20) NOT NULL , member_fname VARCHAR(20) NOT NULL , member street VARCHAR(30) NOT NULL , member_city VARCHAR(20) NOT NULL , member_state VARCHAR(10) NOT NULL , member postcode VARCHAR(4) NOT NULL , member_phone CHAR(10) menber_joindate DATE NOT NULL , CONSTRAINT member_pk PRIMARY KEY (member_no)); Create Table movie_id sTeitie movie release_date "MOVIE" Unique identifier for movie (PK) Movie title Date movies was released by studio Running time of movie in minutes Unique identifier for rating assigned (Fk) Unique identifier for prodcution studio (FK) movie (FK) rating_code studio ia CREATE TABLE MOVIE ( movie id NUMBER(6) NOT NULL , movie title VARCHAR(50) NOT NULL , movie_release date DATE NOT NULL | movie_running_time NUMBER(3) NOT NULL , rating_code VARCHAR(5) NOT NULL , studio_id NUMBER(5) NOT NULL , CONSTRAINT movie pk PRIMARY KEY (movie_id), CONSTRAINT movie tudio_fk FOREIGN KEY (studio_id) REFERENCES STUDIO (Studio_id), CONSTRAINT movie_rating_fk FOREIGN KEY (rating code) REFERENCES RATING (fating_code)); Page 37 of 38 Create Table copy_id copy_purchase_price copy_purchase_date copy_times_rented ‘copy’ Unique identifier for movie copy (PK) Purchase price for this copy Date this copy was purchased Number of times this copy has been rented - updated when a copy is borrowed copy_available 1 Copy availability for rental (¥ = Yes, or N= No) - set to No when a copy is borrowed copy_instock 1 Is copy currently in stock (¥ = Yes, or N = No) ~ when stock is disposed of flag is set to No Unique identifier for movie (FK) movie_id CREATE TABLE COPY ( ‘copy_id NUMBER(S) NOT NULL , copy_purchase_price NUMBER(5,2) NOT NULL , copy purchase date DATE NOT NULL , copy_times_rented NUMBER(3) NOT NULL , copy available CHAR(1) NOT NULL , copy_instock CHAR(1) NOT NULL , movig_id NUMBER(6) NOT NULL CONSTRAINT copy_pk PRIMARY KEY (copy id), CONSTRAINT copy movie_fk FOREIGN KEY (movie_id) REFERENCES MOVIE (movie id), CONSTRAINT copy available chk CHECK (copy_available in ('¥','N')), CONSTRAINT copy_instock_chk CHECK (copy_instock in (°¥','N'})); Create Table + RENTAL" rent_id 1 Unique identifier for rental (PK) rent_date i Date copy was rented rent_due_date 1 Date copy should be returned ie. due date rent_return_date : Date copy actually returned copy_id + Unique identifier for copy (PK) member_no : Unique identifier for member (PK) CREATE TABLE RENTAL ( rent_id NUMBER(6) NOT NULL , rent date DATE NOT NULL , Fent_due_date DATE NOT NULL , rent_return_date DATE, copy_id NUMBER(5) NOT NULL , menber_no NUMBER(S) NOT NULL, CONSTRAINT rental_pk PRIMARY KEY (rent_id), CONSTRAINT rental_member_fk FOREIGN KEY (member_no) REFERENCES MEMBER (mémber_no), CONSTRAINT rental_copy_fk FOREIGN KEY (copy_id) REFERENCES COBY (copy_id)); create Table movie_id genre_id 'MOVIE_GENRE' Unique identifier for movie (PK) (PK) Unique identifier for genre (PK}(FK) CREATE TABLE MOVIE GENRE ( movie_id NUMBER(6) NOT NULL , genre_id CHAR(2) NOT NULL, CONSTRAINT movie_genre_pk PRIMARY KEY (movie id, genre_id), CONSTRAINT movie_genre_movie fk FOREIGN KEY (movie_id) REFERENCES MOVIE (movie_id) ‘ON DELETE CASCADE, CONSTRAINT movie_genre_genre_fk FOREIGN Key (genre_id) REFERENCES GENRE (genre_id)); EI PPENDIX END OF EXAMINATION Page 38 of 38

You might also like