Sunteți pe pagina 1din 5

CS 370/IT 376 Fall 2013 Exam 1 Page 1 Database Management Systems Sept.

27, 2013 Name_________Key______________


1. Define each of the three levels of a database system architecture. What is represented at each of these levels? Be sure to include how many schemas are found at each level in a database implementation (exactly 1 or many) [9 pts] a. Conceptual level(schema count = __1____) This is where the full logical expression of the database structure is represented. All entities, relationships and base elements are here. External and Physical levels are the based on this level. b. External level(schema count = ___many__) These are the external views presented to the end users or groups of users. Only the parts of the database relevant to these users are made available. These elements, tables, etc. may also be expressed in simpler terms and using terminology more appropriate to the users. c. Physical (internal) level(schema count = ___1____) At this level, the storage of data and their access methods, indexes, locations are controlled. It typically is derived from the conceptual level but additional efficiency constraints may be added here.

2. True/False on database approaches. [6 pts] __T__ The hierarchical model was the earliest major database approach. __ T __ The hierarchical model represents the database schema as a tree. __ F __ A network model database is most closely related to mathematical set theory. __ T __ An object oriented database model is akin to a network database model. __ F __ A relational database approach has been the most efficient in performance from the beginning. ___ F _ An object oriented database is todays primary database approach. 3. Define each of these terms [12 pts] Database integrity: the maintenance of the accuracy of the data at all times. No operation should be permitted that might violate the rules of the real world. Database administrator: The person who oversees the design, organization and security of the database Weak entity: An entity whose existence depends on another entity. Transactions to an account, e.g. Cardinality of a relationship: Considers the roles and number of instances entities that are legal in a relationship. One to many, many to many, for example

CS 370/IT 376 Fall 2013 Exam 1


4. True/false on functional dependency theory.

Page 2
[10 pts]

__ T ___ Functional dependency analysis is required in the normalization of a relational schema. __ F ___ Multiple entries of a fact is permitted in a normalized relational database. ___ T __ Normalization attempts to eliminate nulls stored in a database. __ F ___ A null value is equivalent to zero. __ T __ A functional dependency is a relationship between an attribute "Y" and a determinant X (1 or more other attributes) such that for a given value of X the value of the attribute Y is uniquely defined. __ F ___ Functional dependencies can be determined by algorithms to analyze the relation. ___ T __ In practical terms, we want other all non-key attributes to functionally dependent only on the primary key in any relation. ___ F __ Functional dependencies are reflexive, i.e., if a b then b a __ F ___ Transitivity of functional dependencies means that if a c and ab then bc. __ F __ Decomposition of functional dependencies means that if abc then ab and bc

5. For parts a-c, assume we have a relation with the scheme Book (Title, Author, Publisher, PubAddress, PubZip, CopyrightYear, ISBN ) //ISBN = International Standard Book Number [12 pts] a. What would be the likely primary key attribute(s)? ________ISBN____________________[2]

b. List all non-trivial functional dependencies [7]?

ISBN -> {Title, Author, Publisher, PubAddress, PubZip, CopyrightYear } {Title, Author} ->{ Publisher, PubAddress, PubZip, CopyrightYear, ISBN} Publisher -> PubAddress, PubZip

c. If this relation were used as defined (not normalized), describe the insertion and deletion anomalies that could arise. [3]
A publishers address cannot be stored additionally without at least a book A publishers address is replicated and if changed, would have to update many records

CS 370/IT 376 Fall 2013 Exam 1

Page 3

6. For the following Presidential ER diagram develop the relational schema using the pattern TableName(attribute-list). In the interest of time and space, just list 3 more non-key attributes in your table from the entities, not all attributes are necessary. Only specify the relations the entities Presidents, Election and Party_History. Include only the relationship that fall between these four entities. Underline the key attribute(s) in each relation. [16 pts]

PRESIDENTS (Pres, Spouse, Party, Birthdate, Deathdate ) and ok if State is added ELECTION (Year, Votes, Pres) PARTY_HISTORY (Party, Year) ELECTIONLOSERS (Party, Year, Name )

CS 370/IT 376 Fall 2013 Exam 1

Page 4

For the remaining questions, use the following relational schema for a music albums database. Keys are (mostly) underlined. The attributes should be self-evident. If not, please ask for clarification. For a given music track, we code the title, its play length in time (minutes:seconds), its genre (pop, metal, jazz, etc.) and a 5 star maximum rating. The musicians, singers and instrumentalists are all listed in on their contribution to the track. A person may have 1 or more listing for a track. For example someone may both sing and play the piano. The album is a collection of tracks. An album is distributed and owned by a company called the label and has a producer and an engineer. PEOPLE (PID, name, address, zip, phone) CSZ (zip, city, state) TRACKS (trID, title, length, genre, rating, albID) //trID is unique across all albums ALBUMS (albID, albumTitle, year, label, prodPID, engPID, length, price) CONTRIBS (trID, PID, role) [10 pts] 7. a) Underline the appropriate attribute(s) of the primary key for the relation CONTRIBS. b) Circle attributes that could be virtual in the ALBUMS relation. c) Draw arrows from foreign keys to their corresponding relation and attribute. d) What candidate keys are there in the PEOPLE relation? ___{name, address} and phone and PID___

8. Give Relational Algebra statements for the following queries on the rental company database schema. Use the R.A. notation below. BE EXPLICIT in the join condition which attributes make the join where necessary. [25 pts]
Syntax reminder for Relational Algebra expressions: SELECT : condition(relation) PROJECT : attribute-list(relation) SET Operations and JOIN: relation1 OP relation2, where OP is , , - , , , and ||condition RENAME: relation[new attribute names] ASSIGN: new-relation(attrs) R.A. expression

a) List all names and phone numbers of people from zip 90210.

name, phone(zip=90210(PEOPLE))

b) List album titles and labels with a list price of more than $18.

albumTitle, label(price>18(ALBUMS))

CS 370/IT 376 Fall 2013 Exam 1

Page 5

c) List all the musicians and what they played or contributed to on all jazz type tracks.

name, role(genre= jazz(TRACKS |X| trID=trID CONTRIBS |X| PID= PID PEOPLE))

d) Get a list of names of people who produced OR engineered an album, but did not perform on any track. (Hint: set operations are very helpful)

name(((prodPID ALBUMS)[PID] (engrPID ALBUMS)[PID]) - PID CONTRIB)


|X| PID= PID PEOPLE)

e) List names of musicians who have contributed in at least two different roles on the same tracks with ratings 4 or higher. (Hint: self-join)

name, role(rating>= 4 and role <>role2


(CONTRIBS |X| trID=trID and PID=PID CONTRIBS[trID, PID, role2] ) |X| PID= PID PEOPLE))

S-ar putea să vă placă și