You are on page 1of 13

UNIVERSITY COLLEGE OF THE CARIBBEAN

Incorporating Institute Of Management Sciences & Institute Of Management & Production A Member of the Commonwealth & OAS Consortia of Universities

DATABASE MANAGEMENT SYSTEMS [ITT104] EOM EXAM ANSWER KEY


APRIL 2012 INSTRUCTIONS TO MARKERS:
MARKING STUDENTS SCRIPTS 1. Always refer to the marking scheme when marking. 2. For simplicity, uniformity and comparison purposes, mark the same question throughout all the scripts first and then mark the next question (i.e. Q2) throughout. 3. Ignore any names of students that may be on the script to help avoid bias. 4. Use the margin to enter your evaluation of the work in relation to each part of the marking scheme. 5. 1ST Marker please mark in red biro/ink only. 6. 2nd Marker please use green biro/ink only.

7. Close attention must be placed on the level of English displayed when marking. More marks should be awarded to students who show the ability to understand and answer the questions at an appropriate, searching and analytical level. 8. Enter the final marks and any comments at the end of the answer and enter the mark on the front cover page. 9. Enter any pertinent comments in the area assigned on the cover page, for Examiners Comments . Your signature and the date should be inserted as an indication that you have completed the marking process.

SECTION A - Compulsory Question Question 1. (30 marks) SALES DEPOT Create a database that could be used to produce a report of customer details. You are not expected to write a report, just dene a database to contain the information that the report would be based on. The report should list the customers name, account balance, credit limit, and other customer details such as the products they have purchased. The report will also list the customers account representative (one of the sales employees). Each sales representative manages many customers but each customer will be managed by only one representative at any one time. Your design should allow for customers being managed by many account representatives over time as it is possible that some of our employees may leave the company- thus requiring new account representatives for a customer. a) Develop a suitable Entity Relationship Diagram and set of relations (a schema) that may be used to implement your database. (5 marks) The above question should be answered by the candidate drawing a suitable diagram to dene the following three relations. Customer PurchasedProducts Accounts Sales For each relation, the candidate should dene their attributes and the relationship between each relation. The relationship is below. Customer 1:1 Accounts Customer 1:N PurchasedProducts PurchasedProducts N:1 Customer Accounts 1:N Customer b) Write the SQL to create all of the tables and their attributes, data types and key elds (10 marks) The criteria to judge this question against are: 1. Has the candidate created a suitable number of tables? 2. Does each table contain capture enough information? 3. Does each table dene a primary key? 2 marks for each table that contains enough information with a correct primary key 2 additional marks for good column names and appropriate data types. 8

Ignore if the candidate has got the syntax wrong as its not appropriate to test a candidates recollection of syntax in an exam.
create table Customer( CustId int primary key, CustName nvarchar(50), AccountId int, PurchasedId int, ManagedBy int); create table PurchasedProducts( PurchaseId int primary key, ProductId int, ProductName nvarchar(50) ) create table Accounts( AccountId int primary key, AccountBalance int, CreditLimit int, ); create table Sales( ManagedBy int primary key, RepresentativeName nvarchar(50) );

c) Identify and describe how you would develop two (2) queries that you consider relevant to the daily operations of the business. (6 marks) Candidate needs to ask what information would be business need to know each day. Three (3) marks 1. 1 mark 2. 1 mark 3. 1 mark per query. for legal SQL grammar (would the DB execute the query) for the query being something they would need to know daily for description of how they developed the query

Types of query that should be awarded marks 1. 2. 3. 4. Any query to check the referential integrity of the database Which customer bought the most What is the most popular product What is the least popular product

d) Identify and describe how you would develop one (1) report that you could use each month to show which sales representative made the most sales and to which customers each month. (4 marks) 2 marks for a description of what information would go into the report 2 marks for the SQL query

e) Identify and describe at least one other query or report that management would be able to use in assisting them to grow the business and satisfy their customers. (5 marks) Suitable queries are: 1.Are Sales sta managing a roughly equal number of customers? 2.What is the average amount of credit for all customers? 3.Are there any accounts with negative balances? 4.Any query to maintain the referential integrity For such queries, allocate marks: 1 mark for correct SQL grammar 2 marks for the query logic --- does it do what the candidate expects 2 marks for the description of what that query/report would do to meet requirements

SECTION B - Optional Questions [ 20 marks each] f) SQL

You must answer three (3) of these questions. You may answer any three.

Present the main features of a Structured Query Language (SQL) and suggest the reasons why these programming languages are so vital in the creation and maintenance of commercial Databases. (20 marks) Give two (2) marks for each sub-answer, outlined below. Main features of SQL 1. Divides queries up into a number of kinds, e.g., select, delete, insert, update 2. Presents standardized way to query and manipulate data in a relational DB 3. Declarative language (what not how), rather than procedural 4. Examples of queries: 1. select query. What is selected, from which table and use of where 2. delete. What is deleted 3. insert. What is inserted 4. update. What is updated and how is update controlled (where clause) 5. Types are abstract across machine types 1. nvarchar(50) is same on Windows, Unix, and Mac and 32bit and 64bit machines 6. Expression of transactions is straight-forward

1. What to do on transaction failure or success is apparent for programmer 7. Security is an integral part of SQL, specied through SQL language 1. Grant and Revoke permissions per user Reasons why SQL is so vital in creation and maintenance of commercial databases f)..1 SQL is a standard, allowing industry to focus on one solution f)..1..1 Code is portable between dierent DB vendors f)..2 General purpose programming language for database development. f)..3 SQL is quite abstract, a lot of optimizations (but not all) are handled by the DB f)..3..1 This makes it easier to use f)..4 SQL is similar to a managed language like Java or C# f)..4..1 So a SQL programmer is free to concentrate on their solution, not the detail of the computer they are working with f)..5 SQL allows the programmer to specify what should be done, not how f)..5..1 A query is described, but the programmer does not have to say which table is searched rst, for example. f)..6 Give credit for any reasonable reason. g) Normalization g)..1 Explain the purpose of normalization. marks) Reduce redundancy Reduce dependency Organise data more efficiently Reduce the potential for data anomalies .1 Dene clearly, using examples, the normalization rules for 1NF, 2NF and 3NF. (12 marks) See next page (3

The table above is in 1NF, given denition of 1NF used in the lectures. Above table is in 2NF. Candidate must give the above 2NF denition for the mark and they should show what they mean by that denition with reference to an example, either with reference to a number of tables, or the above kind of table denition. Either is ne. The above slide illustrates a step in going from 2NF to 3NF. Students should be given credit for partially dening the step from 2NF to 3NF. Above is now in 3NF. For each 1NF, 2NF and 3NF, give 2 marks for denition and 2 marks for illustration of denition. .2 The following table is already in 1NF & 2NF, but not in 3NF. Normalize the table into third normal form (3NF). Show any extra tables that are created through the normalization process. marks) Employee Department Assignment
Employe Employee Addres e ID Q123 AB56 Surname Brown King s Portmor 333-838 e 3 Tech Servicing D 02 Block A Barbica 511-998 n Q123 Brown 7 Operator Accounts D 11 Block F Phone Employee Department Job Title Operator Servicing Dept Dept Number Location D 02 Block A

(5

Portmor 333-838 e 3

A relation is in 3NF if and only if it is in 2NF and there are no non-key attributes determined by another non-key attribute . The term non-key attribute means an attribute that is neither (1) a candidate key itself, nor (2) part of a composite candidate key. Department, Dept number and Dept location should be placed into new table Department

and a foreign key created for the above table to reference it. These three columns are a candidate key. 2 marks for the candidate showing what the operations are to go from 2NF to 3NF. 2 marks for creation of new table and putting 3 columns into it 1 mark for change to above table to reference new table 3. Semantic Objects [20 marks] A motor vehicle garage business operates as an all inclusive service business. For all vehicles that it repairs it is a one stop destination. A customer simply drops o their vehicle, where the vehicle gets tested, the parts are provided and they are tted by a service mechanic. The customer receives one bill for each vehicle serviced belonging to that customer. Each vehicle species Make, Serial Number, License Number, Year, Color. Details also include Service Date for the given vehicle, Service Details, and Service Charge. The customer is also billed for parts tted, where Part Number, Part Name, Sales Price and Quantity are itemized for that vehicle, as well as the details of the technician who serviced the vehicle such as Technician Code Technician First Name, Technician Last Name and Experience Level. It is a norm for one customer such as car rentals to send more than one vehicle at a time to be serviced. It is also a given that a given vehicle might need to be serviced more than once before it is released form the garage. a) Draw a semantic object diagram of a garage bill that reects the above marks) Situation. Include all the cardinality relationships as appropriate. (8

b) Write the relational representation that describes the situation, showing marks) all the relationships.

(4

c) Draw the appropriate corresponding relational model that represents (6 marks) the outline of the above situation. The diagram should only be at a general level of abstraction, but must include details such as indication for primary and foreign keys.

d) State what type of object category this model would fall under. marks) In about two or three lines, explain your reason for saying so.

(2

4. Relational Database Design a. List any three (3) advantages of a relational database over either the network or hierarchical database models. (3 marks) 1. Hierarchical model has a parent child relationship, one parent with many children, but a child could have only one parent. Relational can model N:M, but hierarchical cant. 2. SQL is declarative 3. More exible in that relational data does not have a xed structure as networks and hierarchical imply 4. Hierarchy database may require the whole database to be redened when data is added Give credit for any other sensible suggestion. 1 mark for each.

List and explain the six (6) properties of relational tables. 1) Values are atomic. 2) Column values are of the same kind. 3) Each row is unique. 4) The sequence of columns is insignificant. 5) The sequence of rows is insignificant. 6) Each column must have a unique name. b. c. What is a secondary key?

(6 marks)

(1 mark)

A secondary key is a field that is identified as being suitable for indexing the data such as a surname, It is used to sort the data in a different order to the primary key, A table can have many secondary keys in fact every field could be a secondary key.

Dene and explain the term referential integrity. How is referential integrity maintained in a database system such as Microsoft Access? (4 marks)

Referential integrity is a data property that requires every value of one attribute (column) of a relation (table) to exist as a value of another attribute in a different (or the same) relation (table). For referential integrity to hold in a relational database, any field in a table that is declared a foreign key can contain only values from a parent table's primary key or a candidate key. For instance, deleting a record that contains a value referred to by a foreign key in another table would break referential integrity. Some relational database management systems (RDBMS) can enforce referential integrity, normally either by deleting the foreign key rows as well to maintain integrity, or by returning an error and not performing the delete. Which method is used may be determined by a referential integrity constraint defined in a data dictionary. 1 mark for definition of referential integrity as above in first paragraph. 1 mark for reference in answer to properties have to be defined for every attribute. 1 mark for an example, e.g., above the delete example 1 mark for how it is maintained in a database like Microsoft Access, but this part of the answer could be for any relational database from any manufactuer. d. Name the three (3) types of relationships that can exist between entities. one-to-one one-to-many many-to-many e. Describe how many-to-many relationships are resolved. (3 marks) (3 marks)

Through the use of another table and a key into that table from a referring table. 1 mark for stating a new table is necessary 1 mark for stating a key into that table is required 1 mark for stating the referring table may have many rows that refer to many other rows in the new table, through that new tables primary key (via the foreign key from the referring table). 5. Database Management Dene what is meant by a database management system and identify three (3) advantages and two (2) disadvantages of using a database management system. (20 marks)

5 marks for a diagram of the 5 components of a DBMS Users, database applications, SQL, DBMS and Database (data on disk) 5 marks for describing them in more detail (saying what they are) 5 marks for an essay-type description of how the components work together to provide the functionality of a database management system. Does the candidate show an understanding of how the parts of the system contribute to the behavior of the whole? 3 advantages are Data integrity Data security Data atomicity Transactional modications Ease of query with SQL compared to other technologies, e.g., XML-based queries 2 disadvantages Cost Technical lock-in to a particular vendor 6. Data Modelling f)..3..2 modeling? What is data (3 marks)

Data modeling is the process of creating a data model for an information system by applying some type of data modeling technique, be it formal or otherwise. This is done to further understand the requirements of the information system being modeled so that an engineer can implement the model using some for of (relational) database technology. 1 mark for denition of data model 1 mark for why its done (understand the requirements) 1 mark for illustrating answer with example f)..3..3 Name another data modeling technique, other than the entity (1 mark) relationship model?

semantic, data-structure, geographic, generic (any from section 3 of this URL) For reference: http://en.wikipedia.org/wiki/Data_model f)..3..4 Entity Dene each of the following terms. (2 marks) A piece of information that is captured about some element of the problem space being implemented within a database, or captured as part of a data model, e.g., Employee, Customer, Part. One mark for denition and one mark for illustration via example or with reference to a table or some part of a data model (assuming that the example is correct. 0 marks if the example is wrong). Attribute (2 marks) A column in a table. A piece of data captured about an entity, e.g., for a customer table, their name or the customers address is an attribute. Primary Key (2 marks)

A primary key is a combination of columns which uniquely specifys a row. E.g., for a Customer table, a CustomerId would be a primary key assuming that the CustomerId was unique for each row. Or there could be a combination of attributes that uniquely identified a row, that is also a primary key. One mark for definition (in particular the notion of it uniquely identifying ONE row) and one mark for an illustrative example. Relationship (2 marks)

A relationship between two relations (tables), e.g., one-toone, one-to-many or many-to-many. Illustrate with an example for the 2 nd mark. d. Describe how each of the terms in part (c) is usually represented in an entity-relationship diagram. Two marks for each. (8

marks)

Diagram taken from http://en.wikipedia.org/wiki/Entity-relationship_model for reference An attribute is some piece of information associated with an entity, e.g., for an artist it would be their name, the recording label that are signed to, their back catalogue and so on.

End of Paper

You might also like