UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series UG Examination 2012-13 DATABASE SYSTEMS CMPC2B08 Time allowed: 3 hours Answer THREE questions. All questions carry equal weight. Notes are not permitted in this examination Do not turn over until you are told to do so by the invigilator. CMPC2B08 Module Contact: Dr. Beatriz de la Iglesia, CMP Copyright of the University of East Anglia Version 1
Page 2 1. You have been asked to assess the suitability of a Database Management System (DBMS) for the following enterprise. A small training company delivers management training to a number of corporate customers. They employ 10 trainers and have 4 members of staff who work on administrative and managerial roles. They have so far used different solutions such as spreadsheets to keep track of the courses scheduled, participants, locations etc. They used different programs to manage payroll, invoicing and other financial information. The course materials, although mostly on electronic format, are not stored centrally. All the employees are computer literate and have access to their own workstations (e.g. laptops, desktops). The company has only been established for 2 years but has plans for expansion, as there is demand for their services. As you are given limited information, you should state any assumptions you make in giving your answer. (a) What aspects of a DBMS would be advantageous to such organization? How would the organization be helped by a DBMS? [20 marks] (b) What disadvantages of using a DBMS would have to be considered in your advice? [10 marks] (c) What type of architecture would be suitable for deployment of a DBMS for such an enterprise? (d) Would you recommend that the enterprise develops a DBMS and what would be the reasons for your recommendation? [4 marks] 2. A small training company uses a relational database to keep details of their customers, available courses, bookings for customers on courses, and sessions that make up a course. Some of the tables in the database are as follows: Customer (cno, cfirstname,csurname, cemail), Course (ccode,ctitle, cdescription) CourseSchedule (ccode*,cstartdate) Session (scode, stitle, stype, sduration, scost, ccode*) Booking (bno, ccode*cstartdate*,bdate, cno*)
Page 3 Where courses are run a number of times with different starting dates they may have a number of schedules; courses are composed of one to many sessions; and customers can have one to many bookings on different course schedules. Primary keys are underlined and foreign keys are marked by *. In addition the attributes of the tables can be interpreted as follows: cno is a unique numeric identifier for a customer, cfirstname is the first name of a customer, csurname is the surname of a customer, cemail is the email address of the customer, ccode is a unique four character code identifying a specific course, ctitle is a text string containing the title of the course, cdescription is a textual description of the course s aims, cstartdate is the start date for a course schedule. Courses are repeated through the year at different start dates, scode is a unique four character code identifying a specific session, stitle is a text string containing the title of the session, stype is a text string containing THEORY or PRACTICE to specify the type of session, sduration is an integer containing the number of hours for a session (always <=3), scost is a decimal specifying the cost of running each session, bno is a unique reference number for a booking issued to a customer, bdate is the date in which the booking is made. (a) Create suitable SQL Data Definition Language (DDL) statements to create the Session table. Define appropriate primary keys and foreign keys and ensure all constraints are reflected in the table definition. Assume all fields are required. (b) Write an SQL statement to insert a new customer called George Smith with an email g.smith@uea.ac.uk. The cno for the new customer should be the result of incrementing the greatest cno in the table by 1. (c) Write an SQL query to display all bookings for a course with code DM01. The query should display the course code, course title and course start date and the customer name for each booking. The data should be displayed in ascending start date order. PLEASE TURN OVER
Page 4 (d) Write an SQL query to display the total cost for all courses. The query should display the course code, course title total cost of the course, given all sessions that are part of the course. (e) Write an SQL query to display any course schedule with no bookings. The query should return the course code and start date. (f) Write an SQL query to delete all course schedules with start dates prior to 01 January 2010. [4 marks] (g) Discuss how bookings should be handled when their associated schedule is deleted. 3. A database is to be designed for a manufacturing company. The company has a number of manufacturing lines, each with their unique identity and with a status. The lines can manufacture different models, switching from one model to another on different dates. Schedules are drawn to decide what product to manufacture on a line on a given day. Each schedule is associated with a required quantity of the chosen model to be produced for that day. The models have a unique identifier and a description, a suggested retail price, a shipping weight and a time that it takes to manufacture them. Raw materials are required for the manufacturing of the models. Each material has a unique identifier code, a name, a unit of measurement, quantity in stock and a reorder level. Raw materials can be used in many different models and in different quantities. The materials are ordered from suppliers. Suppliers have identifiers, names and full contact details. Orders for materials are raised when the materials falls below the reorder level. A date will be associated with an order along with the quantity of each material and its cost. It is also important to record the total order cost. (a) Represent the set of requirements above in an ER Diagram. You must include entities with their attributes. State any assumptions you are making. [16 marks] (b) Identify all relationships among entities including their cardinality and participation constraints. Resolve any many to many relationships. [14 marks]
Page 5 (c) Identify all keys including primary keys and foreign keys. [10 marks] Total [40 marks] 4. (a) Briefly explain the importance of transactions in a database environment. Specify the SQL statements that control transactions and describe the function of each. [8 marks] (b) Describe what is meant by a serialisable schedule in transaction management and explain its importance to the operation of a database management system. [8 marks] (c) In a database environment, describe the operation and the problems addressed by: (i) The two-phase locking protocol, (ii) Typical deadlock detection and resolution algorithms for a centralized database management system, [12 marks] (d) Describe what is meant by the term ''ACID properties" applied to a database management system. [12 marks] 5. (a) Describe the architecture and main operations in a typical data warehouse. You can use a diagram to illustrate your answer. [14 marks] (b) Discuss the main issues that must be addressed if a data warehouse is to be a valuable long-term resource to an organisation. [14 marks] (c) Describe and discuss the advantages of star schemas for data warehouses. [12 marks]
Page 6 END OF PAPER