Professional Documents
Culture Documents
Data manipulation
Powerful SQL operations for retrieving and modifying data
Data Normalization
Primarily a tool to validate and improve a logical
design so that it satisfies certain constraints that avoid
unnecessary duplication of data
CUSTOMER
entity type with
composite
attribute
(c ) Customers’ Instants
12 Ahmed Mohamed 6 Tahrir Square Cairo Egypt 11471
8 Mohamed youssef 7 Giza square Giza Egypt 15888
Chapter 4 © 2013 Pearson Education, Inc. Publishing as Prentice Hall 7
MAPPING ENTITIES INTO RELATIONS
Multivalued Attribute: Becomes a (a)
separate relation with a foreign key
taken from the superior entity
(b)
Primary key
One–to–many relationship
between original entity
Foreign key and new relation
(c)
12 Ahmed Mohamed 6 Tahrir Square, Apt 6, Cairo,Egypt 12 Programming in C++
8 Mohamed youssef 7 Giza square - Giza -Egypt 8 Programming in C++
12 Programming in Java
12 DBMS
Chapter 4 © 2013 Pearson Education, Inc. Publishing as Prentice Hall 8
KEY FIELDS
Keys are special fields that serve 2 main purposes:
Primary keys are unique identifiers of the relation.
This guarantees that all rows are unique
Foreign keys are identifiers that enable a dependent
relation (on the many side of a relationship) to refer
to its parent relation (on the one side of the
relationship).
Is either simple or composite
Word relation (in relational database) is NOT the same
as the word relationship (in E-R model).
Primary Key
Foreign Key
(implements 1:N relationship
between customer and order)
Domain Constraints
Allowable values for an attribute (See Table 4-1)
Entity Integrity
No primary key attribute may be null. All primary key fields MUST have data.
Action Assertions
It is a type of business rules.
Is a statement that ensures that certain conditions are always enforced in the database
no matter what
Is a statement or constraint or control on the actions of the organization.
Referential
integrity
Foreign key
Composite primary key
(b)
Foreign key
new intersection
relation
Composite primary key
Foreign key
(a)
(b)
Composite primary key
formed from the two foreign
keys
(b)
10 11 12 13 14
(b)
EMPLOYEE
relation with
recursive
foreign key
EXAMPLE–FIGURE 4-2B
PK ———–> NON PK
Left side: is called the determinant
Right side: is the dependent
(b)
}
D D
Order _date √ ---- Customer_Order relation
Customer_ID √ ----
OrderI Order Custome Customer_Nam Customer
Customer_Name √ ---- D _date r_ID e Address
Customer Address √ ----
}
Product _description ---- √ Product relation
Product Product
ProductID Unit Price
Product _Finish ---- √ _description _Finish
1 2 3
Customer
Customer_ID Customer_Name
Address