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

Unit III Unit III - Chapter 5

This document provides an overview of relational database design and the relational model. It discusses key concepts such as relations, tables, rows, columns, keys, and integrity constraints. It also covers normalizing data to avoid anomalies and mapping entity-relationship diagrams to logical database schemas. The goal is to represent data using well-structured relations to facilitate data accuracy and integrity.

Uploaded by

Anant Singh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views

Unit III Unit III - Chapter 5

This document provides an overview of relational database design and the relational model. It discusses key concepts such as relations, tables, rows, columns, keys, and integrity constraints. It also covers normalizing data to avoid anomalies and mapping entity-relationship diagrams to logical database schemas. The goal is to represent data using well-structured relations to facilitate data accuracy and integrity.

Uploaded by

Anant Singh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Unit III - Chapter 5 Logical Database Design and the Relational Model

Mohit Agrawal @GU

Relational Database Model


Represents data in the form of tables. Consists of three components:
Data str ct re ! "ables with rows and col mns Data Manip lation Data #ntegrit$

Mohit Agrawal @GU

Relation
A relation is a named& two' two'dimensional table of data "able consists of rows (records) and col mns (attrib te or field) Re* irements for a table to * alif$ as a relation relation: : #t m st ha+e a ni* e name ,+er$ attrib te +al e m st be atomic (not m lti lti' ' +al ed& not composite) ,+er$ row m st be ni* e (can-t ha+e two rows with e.actl$ the same +al es for all their fields) Attrib tes (col mns) in tables m st ha+e ni* e names "he order of the col mns m st be irrele+ant "he order of the rows m st be irrele+ant

Also called the 1st Normal Form


/ Mohit Agrawal @GU

#s this a relation00
Employee_ID 122 Name A Department 3 Course Age %1 $rs& / 4544& months& 1% Research da$s /% $ears& : "a.& 9a+a months& %6 da$s /% $ears& : "a. months& %6 da$s

162

162

Mohit Agrawal @GU

Con+ersion to Relation...
Employee Age_ o Name Department Course Age_Year Age_Days _ID nths 122 122 162 162 A A 7 7 3 3 8 8 4544 Research "a. 9a+a
Mohit Agrawal @GU

%1 %1 /% /%

/ / : :

1% 1% %6 %6
;

QuestionIs this a relation? QuestionWhats the primary key?

AnswerYes: Unique rows and no multivalued attributes AnswerComposite: Emp_ID, Course_Title

Mohit Agrawal @GU

Correspondence with ,' ,'R Model


Relations (tables) correspond with entit$ t$pes Rows correspond with entit$ instances Col mns correspond with attrib tes <=",: "he word relation (in relational database) is <=" the same as the word relationship (in ,' ,'R model)

Mohit Agrawal @GU

>e$ ?ields
>e$s are special fields that ser+e two main p rposes rposes: : Primary keys are ni* e identifiers of the relation in * estion. estion. ,.amples incl de emplo$ee n mbers& social sec rit$ n mbers& etc. etc. This is how we can guarantee that all rows are unique Relationships between relations is accomplished thro gh Foreign keys keys. . Foreign Key is an attrib te in a relation that ser+es as a primar$ @e$ of another relation >e$s can be simple (a single field) or composite (more than one field) >e$s s all$ are sed as inde.es to speed p the response to ser * eries
A Mohit Agrawal @GU

Relational 4chema

Primary Key

Foreign Key

Composite primary key

Mohit Agrawal @GU

=bCecti+es
Dhat is Relational 4chema Con+ert an ,R Diagram to Relational 4chema for f rther implementation Learn the process of <ormaliEation of a Relational 4chema

12

Mohit Agrawal @GU

Integrity Constraints
R les that facilitate acc rac$ and integrit$ of data in a database
Domain Constraints ,ntit$ #ntegrit$ Referential #ntegrit$ Action Assertions F 7 siness r les les. .

11

Mohit Agrawal @GU

Domain Constraints
Domain is the possible set of +al es that ma$ be assigned to an$ attrib te
Attri!ute Customer_ID Domain Name Customer_IDs Description "et o# all possi!le customer IDs "et o# all possi!le customer Names "et o# all possi!le cities
Mohit Agrawal @GU

Domain Character$ si%e 5

Customer_Name

Customer_Names

Character$ si%e &5

City

Cities

Character$ si%e &'


1%

Entity Integrity
<o 5rimar$ @e$ attrib te or its component can be <ULL Used to ens re that
,+er$ relation m st ha+e a primar$ @e$ Data +al es for that primar$ @e$ m st be +alid G arantees that e+er$ primar$ @e$ attrib te is not <ULL

Mohit Agrawal @GU

1/

Referential #ntegrit$
Customer_ID 1222 1221 122% Name A 7 C Address A7C 38G 4"U City Delhi M mbai <oida "tate Delhi Maharashtra U.5 (ostal_Code 1%/6;: 1%:;6/ 11:;6/

Not (ossi!le to enter order *& *rder_ID =1 =% =/ *rder _Date April /& %21% April 6& %21% April 6& %21% Customer_ID ----------122% 12%2 <ULL
Mohit Agrawal @GU 16

I# e)ery order must ha)e a customer-mandatory relation *ptional +elationship

Referential #ntegrit$
"ables are associated sing ?oreign >e$s Referential #ntegrit$ r le states that if there is a foreign @e$ in one relation&
either each foreign @e$ +al e m st match a primar$ @e$ +al e in another relation (Mandator$ relations)or the foreign @e$ m st be <ULL for optional relations

Mohit Agrawal @GU

1;

Referential integrity constraints are drawn via arrows from dependent to parent table

1:

Mohit Agrawal @GU

7 siness R les
4tatements that define or constrain some aspect of the b siness Assert b siness str ct re ControlFinfl ence b siness beha+ior ,.pressed in terms familiar to end sers A tomated thro gh D7M4 software

11

Mohit Agrawal @GU

,ell,ell -"tructured +elations


A relation that contains minimal data red ndanc$ and allows sers to insert& delete& and pdate rows witho t ca sing data inconsistencies Goal is to a+oid anomalies
Insertion Anomaly!adding new rows forces ser to create d plicate data Deletion Anomaly!deleting rows ma$ ca se a loss of data that wo ld be needed for other f t re rows odi#ication Anomaly!changing data in a row forces changes to other rows beca se of d plication Mohit Agrawal @GU

1A

Insertion!can-t enter a new emplo$ee witho t ha+ing the emplo$ee ta@e a class Deletion!if we remo+e emplo$ee 162& we lose information abo t the e.istence of a "a. Acc class odi#ication!gi+ing a salar$ increase to emplo$ee 122 forces s to pdate m ltiple records
Mohit Agrawal @GU 1B

Data Normali%ation
5rimaril$ a tool to +alidate and impro+e a logical design so that it satisfies certain constraints that avoid unnecessary

duplication of data
"he process of decomposing relations with anomalies to prod ce smaller& well well-structured relations

%2

Mohit Agrawal @GU

Mapping ,R Diagrams to Relations F Logical 4chemas


"U((-IE+
"upplier_Name "upplier_City

"U((-Y Num!er /uantity

(A+.
(art_Num!er (art_color

Aim is to con+ert an ,R diagram to its logical schema e* i+alent so that it can be implemented later

Mohit Agrawal @GU

%1

4teps in Con+ersion
4",5 1 ! Map Reg lar ,ntities
Composite Attrib tes M lti'Hal ed Attrib tes

4",5 % ! Map Dea@ ,ntities 4",5 / ! Map 7inar$ Relationships


=ne to Man$ Man$ to Man$ =ne to =ne

4",5 6 ! Map Associati+e ,ntities 4",5 ; ! Map Unar$ Relationships 4",5 : ! Map ternar$ Relationships
Mohit Agrawal @GU %%

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy