Professional Documents
Culture Documents
Entity-Relationship(ER) diagram
- Entity Types, Entity Sets, Attributes
and Keys
9/7/16
9/7/16
9/7/16
Course
Code
Name
Student
Course
Name
Opting
Courses
has
Handles
Offers
Department
Name
4
has
Faculty
ID
Name
9/7/16
Entity
Relationship
Requirements Were
- Department has students and faculty
- Department will offer a set of courses during each semester
- Each student in the department during course registration will be
opting for courses offered by the department
- Faculty will be handling courses
9/7/16
Requirements Were
- Department has students and faculty
- Department will offer a set of courses during each semester
- Each student in the department during course registration will be
opting for courses offered by the department
- Faculty will be handling courses
9/7/16
9/7/16
9/7/16
9/7/16
Requirements:
A lecturer has a staff number, a name and a rank
Research projects have a project id, a sponsoring
organization and a budget
Each project has one lecturer as a principal
investigator
Each project may have other lecturers as coinvestigators
Each lecturer can be principal or co-investigator
on multiple projects
11
9/7/16
12
9/7/16
13
9/7/16
14
Courses
15
9/7/16
16
9/7/16
Simple (Atomic) vs
Composite
Attributes that are not divisible are called
Simple.
EX: USN,AGE
Attributes that can be divided into smaller
parts are called Composite. EX:ADDRESS
17
9/7/16
The unknown category of NULL can be further classified into two cases.
The first case arises when it is known that the attribute value exists but
is missingfor instance, if the Height attribute of a person is listed as
NULL.
second case arises when it is not known whether the attribute value
existsfor example, if the Home_phone attribute of a person is NULL.
COMPLEX ATTRIBUTES
composite and multivalued attrib-utes can be nested arbitrarily. We can
represent arbitrary nesting by grouping components of a composite
attribute between parentheses () and separating the compo-nents with
commas, and by displaying multivalued attributes between braces { }.
Such attributes are called complex attributes.
For example, if a person can have more than one residence and each
residence can have a single address and multiple phones, an attribute
Address_phone for a person can be specified as
{Address_phone( {Phone(Area_code,Phone_number)},Address(Street_a
ddress (Number,Street,Apartment_number),City,State,Zip) )}
Both Phone and Address are themselves composite attributes.
20
9/7/16
Attribute: ER diagram
notations
Attribute
..
Composite Attribute
Multivalued Attribute
Derived Attribute
21
ISE, BMSCE
9/7/16
Entity Type
USN
Name
Email ID
Mobile No.
DOB
1BM14CS001
Aditya
aditya@bmsce.ac.in
9448444160
1-1-1997
1BM14CS002
Bharath
bharath@bmsce.ac.in
8762244699
31-12-1996
Entity Set
22
ISE,BMSCE
9/7/16
23
9/7/16
24
9/7/16
attributes
which
will
uniquely
identify
remaining attributes of entity.
What are the Key attributes in the following
student table ?
25
USN
Name
Email ID
Mobile No.
DOB
1BM14IS001
Aditya
aditya@bmsce.ac.in
9448444160
1-1-1997
1BM14IS002
Bharath
bharath@bmsce.ac.in
8762244699
31-12-1996
ISE, BMSCE
9/7/16
COMPANY
ADDRESS
COMPANY
PRODUCT
ABC
123,XYZ
AAA
DEF
321,XYZ
AAA
USN
Name
Email ID
Mobile No.
DOB
1BM14IS001
Aditya
aditya@bmsce.ac.in
9448444160
1-1-1997
1BM14IS002
Bharath
bharath@bmsce.ac.in
8762244699
31-12-1996
1BM14IS003
Dinesh K
dineshk@bmsce.ac.in
8444160944
6-6-1998
1BM14IS004
Dinesh K
Dineshk_4@bmsce.ac
.in
7446998762
6-6-1998
26
9/7/16
Some entity types have more than one key attribute. For
example, each of the Vehicle_id and Registration attributes
of the entity type CAR is a key in its own right. The
Registration attribute is an example of a composite key
formed from two simple component attributes, State and
Number, neither of which is a key on its own
27
9/7/16
28
9/7/16
CREATETABLESAMPLE_TABLE
(COL1integer,
COL2varchar(30),
COL3varchar(50),
PRIMARYKEY(COL1,COL2));
An entity type may also have no key, in which case it is called a weak
entity type
Value Sets (Domains) of Attributes. Each simple attribute of an
entity type is associated with a value set (or domain of values), which
specifies the set of values that may be assigned to that attribute for
each
entity
if the individual
range of ages
allowed for employees is between 16 and 70, we can
specify the value set of the Age attribute of EMPLOYEE to be the set of
integer numbers between 16 and 70.
Similarly, we can specify the value set for the Name attribute to be the
set of strings of alphabetic characters separated by blank characters, and
so on.
Value sets are not displayed in ER diagrams
29
9/7/16
30
9/7/16
31
9/7/16
32
9/7/16
33
9/7/16
34
9/7/16
35
9/7/16
36
9/7/16
37
9/7/16
38
9/7/16
39
9/7/16
40
9/7/16
Micro Systems
Pvt. Ltd
UNIQ systems
Pvt. Ltd
Laptop
Manufacturing
Supplier
Entity
Desktop
Manufacturing
Hard disk
Keyboard
Part
Entity
41
supplies
relationship
Project
Entity
9/7/16
9/7/16
H.O.D
Supervisor
ASST.PROF
Subordinate
43
9/7/16
Two Types
1. Cardinality Ratios
One to one (1:1)
b. One to Many (1:M)
c. Many to Many (N:M)
a.
2. Participation Constraints
Total
b. Partial
a.
44
9/7/16
9/7/16
46