0% found this document useful (0 votes)
24 views

ATA Base Anagement System: Unit-2

The document discusses database concepts including domains and attributes, integrity constraints and keys, and normalization. It provides examples of a customer order database that is unnormalized and converted through various normal forms including 1NF, 2NF, and 3NF. The goal of normalization is to organize the database into tables with columns, rows and relationships to eliminate redundant and inconsistent data.

Uploaded by

flyingdevil99
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

ATA Base Anagement System: Unit-2

The document discusses database concepts including domains and attributes, integrity constraints and keys, and normalization. It provides examples of a customer order database that is unnormalized and converted through various normal forms including 1NF, 2NF, and 3NF. The goal of normalization is to organize the database into tables with columns, rows and relationships to eliminate redundant and inconsistent data.

Uploaded by

flyingdevil99
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

DATA BASE MANAGEMENT SYSTEM

Unit-2

DOMAINS AND ATTRIBUTES

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]

INTEGRITY CONSTRAINTS AND KEYS:


TYPES OF INTEGRITY CONSTRAINTS: Entity integrity Domain integrity Referential integrity User-defined integrity

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

items ordered by the customer is maintained

Customerid 101

Customer Name Smith

City Code 10

City Name Canad a

Orderno Po001

Order Date 1/1/03

Item code 10 20 30

Desc Hammer Saw Nails Saw

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

CONVERTING THE UNNORMALIZD DATABASE INTO A NORMALIZED DATABASE:


Customerid Customer Name
Smith

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

Second normal form (2NF):


Customer table: Customer Name Smith John Ron City code 10 10 20 City Name Canada Canada Brazil

Customerid* 101 102 103 Order table Customerid* 101 101 101 102 103 103

Orderid* Po001 Po001 Po001 Po002 Po003 Po003

Order date 1/1/03 1/1/03 1/1/03 2/1/03 2/1/03 2/1/03

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

(* indicates primary key)

Third normal form (3NF) :

Customer Customeri name Customer Table: d* 101 102 103 Smith John Ron

City code

City City Name Code* City Table: 10 20 Canada Brazil

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

You might also like