Professional Documents
Culture Documents
Introduction-to-Database-and-SQL-Week 02-Fall-2022
Introduction-to-Database-and-SQL-Week 02-Fall-2022
(entity)
Employee
(Attributes)
• Employee Identifier
• Employee Last Name
• Employee First Name
• Employee Hire Date
• Employee email
Relationships
Student Student_ID
Person Social_Insurance_number
Phone IMEI
One to many relationship
• In a one-to-many relationship, one record in a table can be
associated with one or more records in another table.
Customer Orders
Patient Hospital_visits
Customer Orders
Many to many relationship
• A many-to-many relationship occurs when multiple records in
a table are associated with multiple records in another table.
Books Authors
Books Authors
Book_Author
Constraints
• Primary Key
• Foreign Key
• Unique Key
• Check
• Not Null
Primary Key
• The PRIMARY KEY constraint uniquely identifies each row in a
table. CUSTOMER
Customer_ID (PK)
First_Name
Last_Name
Gender
Email_id
CUSTOMER
Customer_ID (PK)
First_Name
Last_Name
Gender
Email_id (UK)
CHECK Constraint
• A check constraint allows you to specify a condition on each
row in a table for a particular column.
ORDERS
Order_ID (PK)
Customer_ID (FK)
Order_Desc
Order_Qty
Unit_Price (CK unit_price >0)
Not Null Constraint
• The NOT NULL constraint enforces a column to NOT accept
NULL values.
CUSTOMER
Customer_ID (PK)
First_Name (NN)
Last_Name (NN)
Gender
Email_id
Business Rules
Brief, precise, and unambiguous description of a
policy, procedure, or principle
Company Department
Policy makers
managers managers
Direct
Written
interviews with
documentation
end users
Reasons for Identifying and
Documenting Business Rules
• Help standardize company’s view of data
• Communications tool between users and
designers
• Allow designer to:
– Understand the nature, role, scope of data, and
business processes
– Develop appropriate relationship participation rules
and constraints
– Create an accurate data model
Translating Business Rules into
Data Model Components
• Nouns translate into entities
• Verbs translate into relationships among entities
• Relationships are bidirectional
• Questions to identify the relationship type
– How many instances of B are related to one instance
of A?
– How many instances of A are related to one instance
of B?
Naming Conventions
• Entity names - Required to:
– Be descriptive of the objects in the business
environment
– Use terminology that is familiar to the users
• Attribute name - Required to be descriptive
of the data represented by the attribute
• Proper naming:
– Facilitates communication between parties
– Promotes self-documentation