Sie sind auf Seite 1von 24

DATABASE DESIGN AND

APPLICATIONS
SESAP ZG518
Contact Session-2
BITS Pilani
Pilani Campus Febin.A.Vahab
QUIZ

Qn1:
Entity is a _________
a) Object of relation
b) Present working model
c) Thing in real world
d) Model of relation

Ans:Thing in real world

BITS Pilani, Pilani Campus


QUIZ

Qn 2:
Which of the following can be a multivalued attribute?
a) Phone_number
b) Name
c) Date_of_birth
d) All of the mentioned

Ans:Phone_number

BITS Pilani, Pilani Campus


QUIZ

Qn3:
Which of the following indicates the maximum number of
entities that can be involved in a relationship?

A. Minimum cardinality
B. Maximum cardinality
C. ERD
D. Greater Entity Count (GEC)

Ans:B

BITS Pilani, Pilani Campus


QUIZ

Qn4:
A recursive relationship is a relationship between an entity and
________ .

A. itself
B. a subtype entity
C. an archetype entity
D. an instance entity
Ans:A

BITS Pilani, Pilani Campus


QUIZ

Qn5:

Properties that describe the characteristics of entities are called:

A. entities.
B. attributes.
C. identifiers.
D. relationships.

Ans:B

BITS Pilani, Pilani Campus


QUIZ

Qn6:

Double diamond symbol is used for?


A.Entity relationship type
B.Attribute
C.Week entity relationship type
D.Tuple

Ans:C

BITS Pilani, Pilani Campus


QUIZ

• What is degree of a relation?


• What do you mean by participation constraint?
• We can convert any weak entity set to a strong entity set by
simply adding appropriate attributes. Why, then, do we have
weak entity sets?

BITS Pilani, Pilani Campus


ER Diagram-Case Study 1

The music database stores details of a personal music library, and


could be used to manage your MP3, CD, or vinyl collection.
Because this database is for a personal collection, it’s relatively
simple and stores only the relationships between artists, albums,
and tracks.
It ignores the requirements of many music genres, making it most
useful for storing popular music and less useful for storing jazz or
classical music.

BITS Pilani, Pilani Campus


ER Diagram-Case Study 1(In
class)
List of requirements for our database:
The collection consists of albums.
An album is made by exactly one artist.
An artist makes one or more albums.
An album contains one or more tracks
Artists, albums, and tracks each have a name.
Each track is on exactly one album.
Each track has a time length, measured in seconds.
When a track is played, the date and time the playback began (to the nearest
second) should be recorded; this is used for reporting when a track was last
played, as well as the number of times music by an artist, from an album, or a
track has been played.

BITS Pilani, Pilani Campus


ER Diagram-Case Study 2(In
class)
A small accounting firm wants a simple HR application that will help it to keep
track of its employees, their positions, allowances, salary scales, and which
company vehicles their employees drive.

The application must keep track of all the positions at the firm, the employees
filling these positions, the allowances for these positions, the salary scales for
these positions, and the company vehicles assigned to these positions.

BITS Pilani, Pilani Campus


ER Diagram-Case Study 2

Identify the Entities?

Employees
Positions
Allowances
Salaryscales
Vehicles

BITS Pilani, Pilani Campus


ER Diagram-Case Study 2

Identify the Attributes?

Employees-Id,SSN,Firstname,Lastname
Positions-Id,Positionname
Allowances-Id,Name
Salaryscales –Code,Range
Vehicles-Vehicle id,registration num

BITS Pilani, Pilani Campus


ER Diagram-Case Study 2

Business Rules:
One employee can fill in multiple positions
One position can be filled by more than one employee
One position has one particular salary scale.
One Salary scale can be attached to multiple positions
One position is allocated multiple allowances
One allowance can be allocated to multiple positions.
One position is allotted one vehicle.
One vehicle is allotted to one position.

BITS Pilani, Pilani Campus


ER Diagram-Exercise 1(In Class)

Consider the ER diagram shown in figure for part of a BANK


database.Each bank can have multiple branches, and each
branch can have multiple accounts and loans.
a. List the strong (nonweak) entity types in the ER diagram.
b. Is there a weak entity type? If so, give its name, partial key,
and identifying relationship.
c. What constraints do the partial key and the identifying
relationship of the weak entity type specify in this diagram?
d. List the names of all relationship types, and specify the (min,
max)constraint on each participation of an entity type in a
relationship type.Justify your choices.

BITS Pilani, Pilani Campus


ER Diagram-Exercise solution

BITS Pilani, Pilani Campus


ER Diagram-Exercise 2(HW)
Consider the following information about a university database:
• Professors have an SSN, a name, an age, a rank, and a research specialty.
• Projects have a project number, a sponsor name (e.g., NSF), a starting date,
an ending date, and a budget.
• Graduate students have an SSN, a name, an age, and a degree program
(e.g., M.S. or Ph.D.).
• Each project is managed by one professor (known as the project’s principal
investigator).
• Each project is worked on by one or more professors (known as the
project’s co-investigators).
• Professors can manage and/or work on multiple projects.
• Each project is worked on by one or more graduate students (known as the
project’s research assistants).
• When graduate students work on a project, a professor must supervise their
work on the project.
• Graduate students can work on multiple projects, in which case they will
have a (potentially different) supervisor for each one.

BITS Pilani, Pilani Campus


ER Diagram-Exercise 2

• Departments have a department number, a department name,


and a main office.
• Departments have a professor (known as the chairman) who
runs the department.
• Professors work in one or more departments, and for each
department that they work in, a time percentage is associated
with their job.
• Graduate students have one major department in which they
are working on their degree.
• Each graduate student has another, more senior graduate
student (known as a student advisor) who advises him or her
on what courses to take.

BITS Pilani, Pilani Campus


ER diagram-Exercise 3(HW)

BITS Pilani, Pilani Campus


ER diagram-Exercise 3

a. List the entity sets and their primary keys.


b. Suppose the bookstore adds music cassettes and compact disks
to its collection. The same music item may be present in
cassette or compact disk format, with differing prices. Extend
the E-R diagram to model this addition, ignoring the effect on
shopping baskets.

c. Now extend the E-R diagram, using generalization, to model


the case where a shopping basket may contain any
combination of books, music cassettes, or compact disks.

BITS Pilani, Pilani Campus


ER Diagram-Exercise 4(HW)

• Suppose you are given the following requirements for a simple


database for a Hockey league.
• It has many teams, each team has a name, a city, a coach, a
captain, and a set of players,
• each player belongs to only one team,
• each player has a name, a position (such as left wing or
goalie), a skill level, and a set of injury records,
• a team captain is also a player,
• a game is played between two teams (referred to as host_team
and guest_team) and has a date (such as May 11th, 1999) and a
score (such as 4 to 2).

BITS Pilani, Pilani Campus


ER Model-Exercise 5(In Class)

Identify the business rules.

BITS Pilani, Pilani Campus


ER Model-Exercise 6-Identify the
business rules(In Class)

BITS Pilani, Pilani Campus


Relational Model-Exercise 1

Give an example of an attribute (or set of attributes) that you can deduce is not
a candidate key, based on this instance being legal.

Is there any example of an attribute (or set of attributes) that you can deduce is
a candidate key, based on this instance being legal?

BITS Pilani, Pilani Campus

Das könnte Ihnen auch gefallen