Exam 1 - Juniata College

advertisement
CS 370/IT 376 Fall 2011 Exam 1
Page 1
Database Management Systems
Oct. 3, 2011
Name__________________________
1. Define each of the three levels in a database 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 (0, 1, or many).
[9 pts]
a. Conceptual level—(schema count = ____)
b. External level—(schema count = ____)
c. Physical (internal) level—(schema count = ____)
2. List for each of these database users which of the three schemas or levels they would interact with in a
database. There may be more than one level used by a user.
[6 pts]
DBA:
Naïve user:
Applications programmer:
3. Define each of these terms and give an example to support the definition.
[12 pts]
Data dictionary:
Data-program independence:
Integrity constraint:
Multivalued attribute:
CS 370/IT 376 Fall 2011 Exam 1
4.
Page 2
True/false on functional dependency theory.
[10 pts]
______ Functional dependency analysis aids in the normalization of a relational schema
______ Redundancy of fact is at the root of insertion and deletion anomalies in a relational database.
______ Normalization attempts to reduce redundant facts stored in a database.
______ A null value has exactly one interpretation.
______ A functional dependency is a relationship between an attribute "Y" and a determinant (1 or more other
attributes) such that for a given value of a determinant the value of the attribute Y is uniquely defined.
______ Functional dependencies can be ascertained deterministically (by algorithms) to analyze the relation.
______ In practical terms, we want all non-key attributes to be functionally dependent on the primary key in any
relation.
______ Transitivity of functional dependencies means that if a →b and a→c then b→c.
______ Decomposition of functional dependencies mean that if a→bc then a→b and b→c
______ Functional dependencies are reflexive, i.e., if a →b then b →a
5. For parts a-c, assume we have a relation with the scheme
Books(ISBN, Title, CopyrightYear, Author, Publisher, PublisherURL, AuthorEmail )
[13 pts]
a.
What candidate key(s) are there? _________________________________[3]
b. List all non-trivial functional dependencies [6]?
c. Normalize this relation by appropriate decomposition [4]
CS 370/IT 376 Fall 2011 Exam 1
Page 3
For the remaining questions, use the following relational schema for a volunteer organization that needs to keep
track of members, projects, and sponsors, and the relationships between them. Each member is given a memberID.
Each project has a unique name, and has a coordinator, a budget, a timeframe, and so on. A sponsor may be a
business, foundation, government agency, and other source that donates money for projects. Every project must
have at least one sponsor, but may have several. Projects are worked on by the members of the organization.
Members may work on several projects. Assume sponsor names and project names are unique, but member names
may not be.
Members (memId, name, street, zip, phone, dateJoined)
Sponsors (sName, street, zip, phone, type, contactPerson)
Projects (pName, coordinator, budget, startDate, endDate, totalDonations)
ProjectSponsors (pName, sName, amountDonated, dateDonated)
ProjectWorkers (pName, memId, numberHours)
CSZ (zip, city, state)
[10 pts]
6. a) Underline the appropriate attribute(s) comprising the primary key for ProjectSponsors.
b) Circle attribute(s) that could be virtual in Projects.
c) What foreign key(s) are there in ProjectWorkers? _________________________________
d) What foreign key(s) are there in Projects? _______________________________________
7. Draw the corresponding E-R diagram for the above schema. Give all of the appropriate attributes for
entities. Be sure to recognize some relations may be relationships! a) Underline key attributes of each
entity, b) mark any weak entities with a double rectangle, and c) label the cardinality of each
relationship (1:m or m:n).
[15 pts]
CS 370/IT 376 Fall 2011 Exam 1
Page 4
8. Give Relational Algebra statements for the following queries on the college donation database schema. Use
the R.A. notation below. BE EXPLICIT in the join condition what 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 members from the 16652 zip area.
b) List member names who have worked at least 10 hours on the “HuntingdonHH” project.
c) For projects that are still ongoing (endDate is later than today), who are the project sponsors and
contact persons?
d) Generate a list of sponsors who have not donated to a project since January 1, 2008.
e) List names and cities of all members who have worked on more than one project.
Download