Database Management Systems - Juniata...

7
CS 370/IT 376 Fall 2011 Exam 1 Page 1 Database Management Systems Oct. 3, 2011 Name__________KEY_____________ 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 = __1__) This is the logical description of the database. All tables, domains, constraints and relationships are represented. b. External level—(schema count = __many) This level offers several views of the database to the end users They may be subsets of tables, subsets of attributes, joins, etc. c. Physical (internal) level—(schema count = __1_) This describes the actual layouts of the data tables and attributes. It may describe additional data structures such as indexes, file locations, etc. 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: all three, conceptual, external and internal. Naïve user: just the external Applications programmer: also may be limited to external, but usually aware of the conceptual level 3. Define each of these terms and give an example to support the definition. [12 pts] Data dictionary: central location of all terms/vocabulary used in the database and how they map to the tables and attributes. In a bank, the customer and account may refer to the same entity.

Transcript of Database Management Systems - Juniata...

Page 1: Database Management Systems - Juniata Collegejcsites.juniata.edu/faculty/rhodes/dbms/exams/mid1f1… · Web viewThis describes the actual layouts of the data tables and attributes.

CS 370/IT 376 Fall 2011 Exam 1 Page 1Database Management Systems

Oct. 3, 2011Name__________KEY_____________

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 = __1__)

This is the logical description of the database. All tables, domains, constraints and relationships are represented.

b. External level—(schema count = __many)This level offers several views of the database to the end users They may be subsets of tables,

subsets of attributes, joins, etc.

c. Physical (internal) level—(schema count = __1_)This describes the actual layouts of the data tables and attributes. It may describe additional data

structures such as indexes, file locations, etc.

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: all three, conceptual, external and internal.

Naïve user: just the external

Applications programmer: also may be limited to external, but usually aware of the conceptual level

3. Define each of these terms and give an example to support the definition.[12 pts]

Data dictionary: central location of all terms/vocabulary used in the database and how they map to the tables and attributes. In a bank, the customer and account may refer to the same entity.

Data-program independence: changes made to the data organization does not affect programs that use the data. For example, adding an attribute to a table does not require changes to the program that uses the table but does not need to use the new attribute.

Integrity constraint: conditions that must hold at all times in the database. Example, salary value cannot be more than the employee’s manager’s salary.

Multivalued attribute: an attribute in an ER diagram that reflects potentially more than one value, such as phone numbers or email addresses.

Page 2: Database Management Systems - Juniata Collegejcsites.juniata.edu/faculty/rhodes/dbms/exams/mid1f1… · Web viewThis describes the actual layouts of the data tables and attributes.

CS 370/IT 376 Fall 2011 Exam 1 Page 24. True/false on functional dependency theory.

[10 pts]___T__ Functional dependency analysis aids in the normalization of a relational schema

___ T __ Redundancy of fact is at the root of insertion and deletion anomalies in a relational database.

___ T __ Normalization attempts to reduce redundant facts stored in a database.

___F__ A null value has exactly one interpretation.

__ T ___ 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.

__ F ___ Functional dependencies can be ascertained deterministically (by algorithms) to analyze the relation.

__ T ___ In practical terms, we want all non-key attributes to be functionally dependent on the primary key in any relation.

__ F ___ Transitivity of functional dependencies means that if a →b and a→c then b→c.

__ F ___ Decomposition of functional dependencies mean that if a→bc then a→b and b→c

__ F ___ 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? ___ISBN and {Title, Author}___[3]

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

ISBN -> Title, CrYr, Author, Publisher, PubURL, email{Title,Author} -> ISBN, CrYr, Publisher, PubURL, emailPublisher -> PublisherURL

c. Normalize this relation by appropriate decomposition [4]

Books(ISBN, Title, CopyrightYear, Author, Publisher, AuthorEmail )

Publishers(Publisher, PublisherURL)

Page 3: Database Management Systems - Juniata Collegejcsites.juniata.edu/faculty/rhodes/dbms/exams/mid1f1… · Web viewThis describes the actual layouts of the data tables and attributes.

CS 370/IT 376 Fall 2011 Exam 1 Page 3For 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? ____pName, sName_____________

d) What foreign key(s) are there in Projects? __________coordinator_________________

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]

Page 4: Database Management Systems - Juniata Collegejcsites.juniata.edu/faculty/rhodes/dbms/exams/mid1f1… · Web viewThis describes the actual layouts of the data tables and attributes.

CS 370/IT 376 Fall 2011 Exam 1 Page 48. 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 ||conditionRENAME: 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.