Lec#3-ERD+Basic SQL
Lec#3-ERD+Basic SQL
Navathei Slide 3- 1
Chapter 3
Data Modeling Using the Entity-
Relationship (ER) Model
+
SQL Basics
VehicleIdentificationNumber (popularly called VIN)
VehicleTagNumber (Number, State), aka license
plate number.
Each key is underlined
▪ Terminology:
▪ Table, row, and column used for
relational model terms relation, tuple,
and attribute
▪ CREATE statement
▪ Main SQL command for data definition
Ternary
which teachers taught which subjects in which courses
2. think of a multivalued
attribute Employees of the
entity type DEPARTMENT
whose value for each
DEPARTMENT entity is the
set of EMPLOYEE entities
who work for that
department.
Department
Employee Entities
Manager/ Boss??
MANAGES
EMPLOYEE DEPARTMENT
BELONGS TO
Hours
Hours
Start_Date
START_DATE
*each department can be related to any number of employees (N), but an employee can
be related to at most one department (1) = N:1 relationship type
HOURS
*each employee can work on any number of projects (M), and a project can have any
number of employees (N) = M:N relationship type
*In worst case, a composite attribute of all the weak entity’s attributes will be the
partial key.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 88
Weak Entity Types –
Implementation
Weak entity types can sometimes be represented as complex (composite,
multivalued) attributes.
Example:
we could specify a multivalued attribute Dependents for EMPLOYEE, which is a
multivalued composite attribute with the component attributes Name, Birth_date,
Gender, and Relationship.
Or database designer can choose
A weak entity is identified by the combination of its three owner entities from SUPPLIER,
PART, and PROJECT. Slide 3- 98
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei
Converting Weak Entity Type into
Regular Entity Type
Add a Surrogate Key
An artificially generated value for each entity
Supply_id could be used for the supply entity type, converting it into a regular
entity type.