Ans Dbms Assignment

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Practice Problem Set #3

CSC 261/461 (Database Systems), Spring 2017,


University of Rochester
02/09/2017

Problem 1
Drik Gallery, a renowned photo and painting exhibitor, would like to hire you to prepare their database.
The gallery keeps information about artists such as their names, address, age, and sex.
All the artists fall into two categories, painter, and photographer (Yes, photography is an art!).
For each piece of artwork, its unique id, the artist, the year it was produced, its name, description, and price is
stored. Each artwork can be produced by only one artist.
Artworks are subdivided into two categories, paintings, and photos.
Photos have information about the camera used to capture the photo, camera’s exposure time, focal length, and
aperture. The paintings have information about its genre, which can be identified by an integer.
Details of the genres:
1. History Painting: Religious, historical or allegorical work, with a moral message.
2. Portrait Art: Includes individual, group or self-portraits.
3. Genre Painting: Scenes of everyday life.
4. Landscape Painting: Paintings whose principal content is a scenic view.
5. Still Life Painting: An arrangement of domestic objects or everyday items.

Finally, the gallery keeps information about customers. For each customer, the gallery stores his/her cus-
tomer id, name, address, and the artists and the artworks the customer is interested in. Customers address has
the following divisions-Street Address, City, State, Zip.
Draw an ER diagram for this database.

Solution:
This design can vary according to your assumption. So, there is no unique answer. When in doubt, always write
your assumption. One possible solution is given in figure 1

PS # 3 Page 1 / 5
Figure 1: ER Diagram for Drik Gallery

Problem 2
Consider the ER diagram shown in Figure 2 for part of a BANK database. Each bank can have multiple branches,
and each branch can have multiple accounts and loans.

1. List the strong (nonweak) entity types in the ER diagram.

2. Is there a weak entity type? If so, give its name, partial key, and identifying relationship.

3. What constraints do the partial key and the identifying relationship of the weak entity type specify in this
diagram?

4. List the names of all relationship types, and specify the (min, max) constraint on each participation of an
entity type in a relationship type.

5. List concisely the user requirements that led to this ER schema design.

6. Suppose that every customer must have at least one account but is restricted to at most two loans at a time,
and that a bank branch cannot have more than 1,000 loans. How does this show up on the (min, max)
constraints?

Solution:
1. Entity types: BANK, ACCOUNT, CUSTOMER, LOAN

2. Weak entity type: BANK-BRANCH. Partial key: BranchNo. Identifying relationship: BRANCHES.

3. The partial key BranchNo in BANK-BRANCH specifies that the same BranchNo value may occur under
different BANKs. The identifying relationship BRANCHES specifies that BranchNo values are uniquely
assigned for those BANK-BRANCH entities that are related to the same BANK entity. Hence, the com-
bination of BANK Code and BranchNo together constitute a full identifier for a BANK-BRANCH.

PS # 3 Page 2 / 5
Figure 2: An ER diagram for a BANK database schema (ref: Fundamental of Database Systems by Elmasri and
Navathe)

PS # 3 Page 3 / 5
Figure 3: Relationships

4. Refer Fig. 3

5. The requirements may be stated as follows: Each BANK has a unique Code, as well as a Name and Ad-
dress. Each BANK is related to one or more BANK-BRANCHes, and the BranhNo is unique among
each set of BANK-BRANCHes that are related to the same BANK. Each BANK-BRANCH has an Ad-
dress. Each BANK-BRANCH has zero or more LOANS and zero or more ACCTS. Each ACCOUNT
has an AcctNo (unique), Balance, and Type and is related to exactly one BANK-BRANCH and to at
least one CUSTOMER. Each LOAN has a LoanNo (unique), Amount, and Type and is related to exactly
one BANK-BRANCH and to at least one CUSTOMER. Each CUSTOMER has an SSN (unique), Name,
Phone, and Address, and is related to zero or more ACCOUNTs and to zero or more LOANs.

6. Refer Fig. 4

PS # 3 Page 4 / 5
Figure 4: Relationships after changes

PS # 3 Page 5 / 5

You might also like