Académique Documents
Professionnel Documents
Culture Documents
Database Design
• Teorey Toby, Sam Lightsto, Tom Nadeau, HV Jagadish "DB Modeling & Design, Logical
Design", 5th Edition, Morgan Kaufmann, 2011
Overview
• Basic concepts
• Assets, Asset set and qualifications, Communication, Communication set of limitations
relations and relations types, role definitions
• key qualifications
• Helpful Concepts
• Generalization
• Clustering, Composition
• Conceptual scheme
• Conceptual design
• Data requirements annotated
• Detailed description of the types of entities (entity types)
8
Asset / Communication sets
key
key
Multivalued attr.
STUDENT LESSON
R
N N
11th
ER notations
There is addiction ( existence dependency):
• each a 'b' presence in the entity set B, if necessary, in the presence of a set of 'a'
must establish the existence of a relationship, "B assets are set to be dependent
on a set of assets» is called. primary entity A, B are called secondary entity.
ER: N N
to reader B
a
b
13
Key and Strong / Weak Entity Sets
• Entity / entities in equation set / group relation to the qualities or
characteristics used to distinguish from each other
key It called.
• Super key ( SuperKey): All switches are super key.
• Candidate key ( candidate key): BA An entity / relationship set of the 'K' key to any
self-subset super super key, if not the 'K' that entity / relationship set of candidates will
be key. (In other words, «a candidate key" = "minimal super key»)
• It can not be found in a key set of assets ( though not together all the key
attributes) This entity set
«Weak set of assets» It called. Key to the set of assets that «strong set of assets» the
statement said.
• Weak entity set, with a strong presence or N-1 type set 1-1
There are not dependent It must establish a relationship.
• The weak entity set, distinguishing quality In order to know the entities that are connected to the same
strong asset (s) - MOMENT It needs to be defined.
15
Examples of weak entity set
one N
HIGH SCHOOL reader
STUDENT
name
öğrno
Grand total
satışno
the satışform
history
one
ss
N Line
LineNum
Identifying key
keys in Relation:
• NN set of key relationships is the key to all of the entities in the
cluster correlation.
• 1-N N-side switch of the correlation set of correlation values
in the key.
• The key switch of any of one to one correlation set may be a
set of assets.
The key to the weak entity set , There is a strong correlation cluster in
the presence (s) is + per sini moment.
17
ER-correlation samples multigrade
WORKING CPM PROJECT
MACHINE
18
ER-correlation samples multigrade
ER-correlation samples multigrade
• Exception restrictions:
D • OR
• AND
21
Clustering ( aggregation, "part of" relation)
• «Has a", "has / have been» relation
• 'Cluster' with 'parts' used for correlation between.
• Part relegated to the "existence dependent" going the composition. (Used in UML)
• Supertype in the generalization asset qualifications / key, which was applicable in the presence of subtype.
"Part of" if their relationship, moving to the nature of the assets in the asset type in all parts Type It is not
possible.
22
Modeling with UML
UML generalization UML constructs composition / aggregation constructs
of
CAR
STUDENT LESSON
Registration number BA
No. Make # Name and # Name of
to B
one..* 0 .. *
=> EU
CHAPTER STUDENT
1..1 0 .. *
=> Read
26
Example (UML)
MALE WOMAN
0..1 0..1
=> Married
to B
1..6 0..50
=> EU
subordinate
STUDENT
of
STUDENT LESSON
• The key to what a person can receive a set of correlation again in the same course
would be different in the following example?
years of
success
SHIP Example (UML)
gnome BA
weight
{Necessarily OR}
0..1
Room No MOMENT
<== located BA
0..1
0 .. *
Staff PNO BA
1..1
one..* Part BnO BA
=> Calışır
Example 1: COMPANY Database
• We need to define a database schema design based on The Following (simplified) requirements
of the COMPANY Database:
• The company is organized into departments . Each department has a name, number and an
employee wHO manages the department. We keep track of the start date of the department
manager. A department may have several locations.
• Each department controls A number of projects . Each project has a unique name, unique
number and is located at a single location.
• We store each EMPLOYEE's social security number, address, salary, and birthdate.
• Each employee works for one department but may work on several projects.
• We keep track of the number of hours per week that an employee currently works on
each project.
• We also keep track of the direct supervisor of each employee.
• Each employee may have A number of dependents .
• For each dependent, we keep track of their name, sex, birthdate, and relationship to the
employee.
Initial Design of DB COMPANY
• Based on the requirements, we can identify four initial entity types in the COMPANY database:
• The following example is being followed by the introduction of a section notes. If you entered a note
(GRADE), while for a PROF veriliyos SECTION SECTION and then by A; "Assigns" the relationship is going
to be needed? Of course, "will" Becoming.
COMPANY DBU (continued)
• In the refined design, some attributes from the initial entity types are refined into relationships:
• In general, more than one type of relationship can exist between the same Participating entity types
(types Manages and WORKS_F area distinct relationship between EMPLOYEE and DEPARTMENT
(Different Meanings and different relationship instances.)
35
COMPANY DB UML diagram
EMPLOYEE DEPARTMENT
1..1
one..* ==> works for
0..1
0 .. *
==> supervises
0..1
==> manages
1..1 1..1
one..*
1..1
0 .. * one..* startDate LOCATION
==> unique
surroundings BA
0 .. *
0 .. * PROJECT
DEPENDENT
hours one..*
36
COMPANY DB diagram
Recursive
relationship
Example-2 (ER, UML)
• Cities, countries and design a database showing rivers.
City Country
City R Country
N
one..* 1..1 one..*
1 N
0 .. *
M
River
River
City R Country
1 City one..* 1..1
N Country
one..*
N S River
M 0 .. * River
Example 3
Part-employee data involving the departments and personnel information on a company
Think the base.
• Each chapter numerous staff Every staff member has and is subject to a maximum of one section.
• only an administrator of a section ( necessarily) has. Accordingly the following conditions independently
Your answer ...
• The manager of a chapter, but it can be connected to a personnel department, how an ER model
can be drawn?
0 .. *
1..1 ==> with
B PA
My manager?
• If the manager can be a part of any staff, how an ER model can be drawn?
0 .. *
1..1 ==> with
B PA
History:
satışno: 12 11/06/2009
Unit
Fie t
LineNum Parr ç anon Parr ç I ais Definition Quantity Total
Sports, basketbaIIs
one 23 645 shoes l one 110 110
3 . . . . . .
geneltopl
aM: 880
The above example shows the contents of a sale involving sales information form. corresponding
database, SALES, PARTS AND LINE It consists of 3 sets including asset. (The same can be repeated in different
parts parçanol line.)
This set of assets, properties and draw the ER diagram illustrating the relationships between them.
PART PNO BA
SALES
name
price
definition
1..1
0..1 Grand total and
the satırtoplamfiyat
0 .. * properties derived from
LINE nature. Writing in the
0 .. * conceptual design
quantity
becomes.
Example 5
• Among the teams with multiple players, it asked to be kept information about games
involving two teams. ( Players can have up to a team member. )
• in which every game involving teams (which team is which guest host) and kept
information such as the date and outcome of the game.
• Every game in which players get the information that is being followed for the team.
N one
player
team
belonging to
one
play one
score home
guest
score
NMR N
N
game
results
history PK
Example 6
• processing time of transactions on a bank account ( day, hour) transaction amount and type of
information following the event tutuluyor.b diagram:
• The above solution treatment in the same time on the same account Failure to
the case is valid. When he raised this condition, the design process should keep the time as the
system time;
• Each is Identified by a flight FLIGHT NUMBER, and Consists of one or more flıght_legs with
leg_numbers 1, 2, 3, etc.
• Each leg has scheduled arrival and departure times and airports, and has many
leg_ınstances - one for each DATE on which the flight travels. FARES are kept for each
flight.
• For each leg instance, seat_reservatıons are kept, as is the AIRPLANE used in the leg, and
the actual arrival and departure times and airports.
• Candidates can make a company's negotiations with multiple sections may take different positions and proposals from each department;
But you can get an offer from one position section.
• Offered salary of the position, a number of features such as more features are required to be kept ..
• On the day of the interview (year / month / day) is tutluy information. interviews with the same section, but can be a different day.
• Both candidates names must be unique in company names may assume that the system ..
position name
name
name N N
COMPANY
CANDIDATE interview CHAPTER
one
Date (dd) N made
name name
CANDIDATE
one interview one COMPANY
N name
Date (dd)
POSITION
IT INTERVIEW salary
one
chapter ...... 45
N bid
Example 9 (generalization)
47
Example 11 (generalization)
48
Example 12: computer sales VT
N
software
one
one
computer
one İşl ist.
D MD b N
laptop desktop
must
dH
by
one
N
N MN
dH
equipment
peripherals
N1
D
D
memory video
keyboard monitor
the seeskart
mouse