Download Copy of first test for FAll 2003

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Oracle Database wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Relational algebra wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Functional Database Model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Database wikipedia , lookup

Clusterpoint wikipedia , lookup

Versant Object Database wikipedia , lookup

ContactPoint wikipedia , lookup

Database model wikipedia , lookup

Relational model wikipedia , lookup

Transcript
CS 4504/6504 Test 1
Name
Fall 2003
[10] I. Give at least three advantages that database systems have over traditional file
systems.
[10] II. Recall that logical data independence is the capacity to change the conceptual
schema without having to change external schemas or application programs.
Briefly discuss the importance of logical data independence.
[20] III. Consider the following subset of information from a medical database:
1. The information about a patient includes the patient’s Social Security
number, name, and address.
2. The information about a doctor includes the doctor’s Social Security number,
name, and specialty.
3. Each drug is sold by a particular pharmaceutical company. The information
about a drug includes the drug’s trade name. A drug’s trade name identifies it
uniquely among the drugs manufactured by a given pharmaceutical company.
However, different companies may use the same trade name for different
drugs.
4. Once a given pharmaceutical company is deleted from our database, we are
no longer interested in keeping the data about the drugs manufactured by that
company.
5. Each time a doctor describes a drug for a patient, the date and quantity of the
prescription must be recorded. If a doctor prescribes the same drug for the
same patient more than once, only the most recent prescription information is
stored.
Draw an ER diagram to represent this application. Be sure to specify the
primary keys of the entity sets, which entity set(s) (if any) are weak, the
cardinalities of the relationships, and the participation constraints in your
diagram.
Note: The next page of the exam has intentionally been left blank so that you
can use it to draw the ER diagram.
CS 4504/6504 Test 1
ER diagram for question III:
Fall 2003
Page 2
CS 4504/6504 Test 1
Fall 2003
Page 3
IV. In class we have discussed the importance of representing the semantics of the data
for the application you are modeling when you design a database. Most such
applications have certain integrity constraints that must hold on this data (i.e.,
conditions that restrict what data values can be stored in the database). Some
integrity constraints can be incorporated into the relational database design, whereas
others either have to be defined using special SQL commands or have to be enforced
by the application programs.
[5] a. Using the medical application described in question III, give a specific
example of an integrity constraint that can be reflected in the design of the
relational database schema for that application.
[5] b. Using the medical application described in question III, give a specific
example of an integrity constraint that cannot be reflected in the design of the
relational database schema for that application but that would be a very
reasonable constraint to enforce.
V. Consider the following relation:
Employees (SSN, Name, Address, BirthDate, Salary, JobTitle)
[5] a. What would have to be true for the collection of attributes (Name, BirthDate)
to be a candidate key for this relation?
[5] b. What attribute or collection of attributes is the best choice for the primary
key? Why?
[5] c. Give an example of a collection of attributes that is a superkey.
CS 4504/6504 Test 1
Fall 2003
Page 4
VI. Consider the following ER diagram:
DName
SSN
Name
Office
Since
WorksFor
Faculty
MainOffice
Department
Heads
Since
[5] a. Notice that each department must have exactly one department head. Explain
how this is represented in the ER diagram via key and participation
constraints.
[10] b. Map the ER diagram into a relational database schema. Be sure to indicate the
primary key for each relation and any foreign keys. Also, if there are integrity
constraints that cannot be represented in the relations, be sure to state what
those are.
CS 4504/6504 Test 1
Fall 2003
Page 5
[10] VII. Map the following ER diagram into a relational database schema. Be sure to
indicate the primary key for each relation and any foreign keys. Also, if there
are integrity constraints that cannot be represented in the relations, be sure to
state what those are.
Name
SSN
Address
MedicalResearcher
StartDate
Oversees
Name
Gender
SSN
ID
Name
Age
Patient
Tests
Medication
CS 4504/6504 Test 1
Fall 2003
Page 6
VIII. Foreign keys are commonly used in relational database designs to establish
relationships.
[5] a. Explain the use of foreign keys to establish 1:N relationships. You may use
an example in your explanation if you wish.
[5] b. Explain the use of foreign keys to establish N:M relationships. You may use
an example in your explanation if you wish.