ATA Base Anagement System: Unit-2
ATA Base Anagement System: Unit-2
Unit-2
EX:1. A attribute Month has associated domain in [1-12] 2. A attribute Day has associated domain in [sun,mon,tue,wed,thu,fri,sat]
TYPES OF KEYS:Unique Key Not Null Primary key Composite Primary key Foreign Key
NORMALIZATION:
First normal form (1NF ): Ex:-: Consider a unnormalized database in which the details regarding the
Customerid 101
City Code 10
Orderno Po001
Item code 10 20 30
Qty 10 10 50 5
102
Canad Po002 John 10 2/1/03 20 a into a normalized database: Converting the unnormalizd database
103
Ron
20
Brazil
Po003
2/1/03
30 10
Nails Hammer
25 10
City Code
10
City Name
Canad a Canad a Canad a Canad a Brazil Brazil
Orderno
Order Date
1/1/03
Item Code
10
Desc
Qty
101
Po001
Hammer
10
101
Smith
10
Po001
1/1/03
20
Saw
10
101
Smith
10
Po001
1/1/03
30
Nails
50
102
John
10
Po002
2/1/03
20
Saw
103 103
Ron Ron
20 20
Po003 Po003
2/1/03 2/1/03
30 10
Nails Hammer
25 10
Customerid* 101 102 103 Order table Customerid* 101 101 101 102 103 103
Item code* 10 20 30 20 30 10
Qty 10 10 50 5 25 10
Item Table
Item code* 10 20 30 20 30 10 Desc Hammer Saw Nails Saw Nails Hammer
Customer Customeri name Customer Table: d* 101 102 103 Smith John Ron
City code
10 10 20
Ordermast Table:
Orderid* Po001 Po002 Po003 Orderdate 1/1/03 2/1/03 2/1/03 Customerid 101 102 103
Item Table:
Item code* 10 20 30 Desc Hammer Saw Nails
Order table:
Orderid* Po001 Po001 Po001 Itemcode* 10 20 30 Qty 10 10 50
Po002
Po003 Po003
20
30 10
5
25 10