Test 2 Review A: Questions

R2a.1.

In studying normal forms, we first defined BCNF: A relation is in BCNF if every nontrivial functional dependency for that relation has a superkey on its left-hand side. We later explored a closely related but more complex definition, which we termed third normal form (3NF). Third normal form is more general than BCNF: That is, all BCNF relations are in 3NF, but some 3NF relations are not in BCNF.

  1. Explain the deficiency of BCNF that led to the definition of 3NF.

  2. Describe how the definition of 3NF differs from the definition of BCNF.

R2a.2.

Suppose we have a relation R(abcde) whose keys are {ab} and {cd}. Explain why each of the following FDs is consistent with third normal form.

  1. a b c → d
  2. a c e → b c
  3. a c e → e
R2a.3.

Suppose we have the relation

books(authoraffiliationtitletypeprice)

with the functional dependencies

author title → type price
type → price
author → affiliation

Identify which of the functional dependencies violate 3NF, and synthesize the relation into 3NF relations.

R2a.4.

Draw an entity-relationship diagram for a database of used vehicles, including each vehicle's VIN (identification number unique to each vehicle), year of manufacture, make, model, color, type (car/truck/minivan/etc.), seats (number), buyer name, and buyer phone number. Knowing just the make and model is enough to determine the vehicle's type and the number of seats, and each buyer (who may purchase multiple vehicles) has just one phone number.

R2a.5.

Draw an entity-relationship diagram for a manufacturer's database to track client orders. The manufacturer carries several lines of products. Each order can involve several products, and there is a quantity and price associated with each product ordered. The manufacturer tracks client names and telephone numbers. (You need not bother indicating keys.)

R2a.6.

Draw an entity-relationship diagram for a court database. A case is initiated by a plaintiff, who names the defendant and the plaintiff's lawyers. Later, after the defendant is notified of the case, the defendant names lawyers representing that side. Then a judge is assigned to the case. (You need not bother with indicating attributes or keys.)

R2a.7.

Explain what is meant by the term weak entity set, and give an example.

R2a.8.

In designing a database for automotive sales, we create the following entity-relationship diagram. Convert it into a corresponding set of relational schemas, underlining the primary-key attributes for each schema.

R2a.9.

Suppose we were writing a Web site to manage paper submissions and reviews for a variety of conferences hosted by different organizations. We design the following entity-relationship diagram. Convert it into a corresponding set of relational schemas, underlining the primary-key attributes for each schema.

R2a.10.

Below is an entity-relationship diagram for a bug database. Convert it into a corresponding set of relational schemas, underlining the primary-key attributes for each schema.

R2a.11.

Suppose our company runs several projects, each involving several teams of workers, as indicated in the below entity-relationship diagram. Convert it into a corresponding set of relational schemas, underlining the primary-key attributes for each schema.

R2a.12.

Below is an entity-relationship diagram for tracking home sales. Convert it into a corresponding set of relational schemas, underlining the primary-key attributes for each schema.

R2a.13.

Below is an entity-relationship diagram for tracking and discussing bug reports for a collection of software packages. Convert it into a corresponding set of relational schemas, underlining the primary-key attributes for each schema.

R2a.14.

Below is an entity-relationship diagram for a course schedule where each section can have any number of instructors. Convert it into a corresponding set of relational schemas, underlying the primary-key attributes for each schema.

Test 2 Review A: Solutions

R2a.1.
  1. Some non-BCNF relations cannot be broken into BCNF relations without breaking apart some FDs applying to the original non-BCNF relation.

  2. With 3NF, an FD is also acceptable if its right side consists entirely of attributes appearing in some key for the relation.

R2a.2.
  1. Its left side is a superkey.
  2. Each right-side attribute either appears on the left side (c) or appears in a key (b).
  3. It is trivial
R2a.3.

The violating FDs are type → price and author → affiliation. The relation synthesizes into three 3NF relations.

writers(authoraffiliation)
prices(typeprice)
books(authortitletype)

R2a.4.
R2a.5.
R2a.6.
R2a.7.

A weak entity set is an entity set in an entity-relationship diagram for which the key for the entity set includes attributes found in another entity set: That is, to identify a particular entity in the set, we must specify how the entity relates to another entity.

An example of a weak entity set is the notion of a course's section. Knowing about a section alone — without information about the course to which it relates — isn't very meaningful. Thus, to identify a section, we really need to know the course information, and so the Section entity set would be a weak entity set.

R2a.8.

customers(idname)
autos(vinyearmakemodelbuyer_id)
models(makemodel)

R2a.9.

reviewers(idname)
reviews(idauthortitleratingreview)
papers(authortitlesponsoryear)
conferences(sponsoryearlocation)

R2a.10.

projects(nameurl)
bugs(proj_nameiddescriptionassignee_login)
developers(loginalias)

R2a.11.

projects(name)
teams(project_nameleader_id)
workers(idofficeleader_id)

R2a.12.

homes(street_addresszipsquare_feet)
sales(street_addresszipdateamount)
buyers(ssnname)
home_buyers(street_addresszipdatessn)

R2a.13.
projects(nameurl)
bugs(project_nameiddescription)
comments(authorposttimetext)
comment_concerns(authorposttimeproject_namebug_id)
R2a.14.

instructors(first_initiallast_namephone)
sections(programnumberidsemestertime_slot)
teaches(semesterprogramnumbersection_idfirst_initiallast_name)
courses(programnumbertitle)
requires(requiring_programrequiring_numberrequired_programrequired_number)