Description:
Welcome to the comprehensive guide on Relational Database Management System (RDBMS) concepts, tailored for final year B.Sc. Computer Science students affiliated with Alagappa University. This document covers fundamental principles and advanced topics in RDBMS, offering a structured appr...
Description:
Welcome to the comprehensive guide on Relational Database Management System (RDBMS) concepts, tailored for final year B.Sc. Computer Science students affiliated with Alagappa University. This document covers fundamental principles and advanced topics in RDBMS, offering a structured approach to understanding databases in the context of modern computing. PDF content is prepared from the text book Learn Oracle 8I by JOSE A RAMALHO.
Key Topics Covered:
Main Topic : Relational Database Design
Sub-Topic :
Features of Good Relational Database Design, Design Alternative: Larger Schema, Smaller Schemas, Atomic Domains and First Normal Form, Decomposition Using Functional Dependencies, Keys and Functional Dependencies,Trivial Functional Dependency, Boyce-Codd Normal Form, BCNF and Dependency Preservation, Third Normal Form, Higher Normal Forms, Functional-Dependency Theory, Closure of a Set of Functional Dependencies, Lossless Decomposition, Decomposition using Multivalued Dependencies, Fourth Normal Form, Database-Design Process, E-R Model and Normalization, Naming of Attributes and Relationships, Denormalization for Performance, Other Design lssues, Company Database Design Example – Design 1
, Company Database Design Example – Design 2
, Company Database Design Example – Design 3
, Modeling Temporal Data
Target Audience:
Final year B.Sc. Computer Science students at Alagappa University seeking a solid foundation in RDBMS principles for academic and practical applications.
URL for previous slides
Unit I:
Chapter 6 : Database Design and ER Model https://www.slideshare.net/slideshow/lecture-notes-unit-1-chapter-6-e-r-model/271813542
Chapter 1 : Introduction to DBMS
https://www.slideshare.net/slideshow/lecture-notes-unit1-chapter1-introduction/271392881
RDBMS -Unit II
Chapter 7
Relational Database Design
Prepared By
Dr.S.Murugan, Associate Professor
Department of Computer Science,
AlagappaGovernmentArts College, Karaikudi.
(Affiliated by AlagappaUniversity)
Mailid: [email protected]
Reference Book:
Database System Concepts by Abraham Silberschatz, Henry
F.Korth, S. Sudharshan
7.1 Features of Good Relational Database Design
➢Thegoalofarelationaldatabasedesignistogenerateasetof
relationschemaswhichisusedtostoreinformationwithout
unnecessaryredundancy.
7.1.1 Design Alternative 1: Larger Schema
➢ThreecustomersmayavailthesingleloanamountRs.10000
withtheloannumberL-100.
➢Inbor_loanrelation,thevalueofloannumberandamountis
repeated.
➢In loan and borrower relation, the amount of each loan exactly
once.
7.1.1 Design Alternative 2: Larger Schema
➢Anotheralternativedesignloan_amt_branchisderivedfrom
loanandloan_branch.
7.2 Atomic Domains and First Normal Form
➢ArelationschemaRisinfirstnormalform(1NF)if
thedomainsofallattributesofRareatomic.
➢Adomainisatomicifelementsofthedomainare
consideredtobeindivisibleunits.
➢Adomainisnon-atomicifelementsofthedomainare
consideredtobedivisibleunits.
➢Exampleforatomicdomain:Age,Rollnumber
➢Examplefornon-atomicdomain:Address(doorno,
street,city,etc),Name(Firstname,Lastname,middle
name)
7.2 Atomic Domains and First Normal Form
Example:depositortable.
7.3 Decomposition Using Functional Dependencies
➢Afunctionaldependency(FD)isarelationshipbetweentwo
attributes,typicallybetweenthePKandothernon-keyattributes
withinatable.
For Ex: Registernumber→Name
Name is functionally dependent on Register number.
Name: Dependent attribute, Register number : Independent
➢Decomposition is the process of decomposing a larger table in to
more than one table without unnecessary redundancy.
For Ex:
Original Table: Bor_loan= (customer_id, loan_number, amount)
Decomposition Table:
➢Borrower=(customer_id,loan_number)
➢loan=(loan_number,amount)
7.3.1 Keys and Functional Dependencies
For example, the functional dependency
customer_street→city, holds on relation R; but not
satisfied. Because two different cities may have the
same street name.
Sowe cannot uniquely determined.
7.3.2 Boyce-CoddNormal Form
Bor_loan= (customer_id, loan_number, amount)
In the above relation, the functional dependency loanno→amount
holds, but loan_numberis not a super key. Because many customers
may have same loan number.
To avoid the above problem, the Bor_loantable divided into two
table;
➢Borrower=(customer_id,loan_number)
➢loan=(loan_number,amount)
Intheaboverelation,thefunctionaldependencyloanno→
amountholds,andloan_numberisasuperkey(Actually,in
thiscaseprimarykey)
7.3.4 Third Normal Form
consider cust-banker-branch relationship and the functional dependency
cust_banker_branch=(customer_id, employee_id, branch_name, type)
Employeejd→branch-name. (Refer Fig 7.7)
7.3.4 Third Normal Form
7.3.5 Higher Normal Forms
➢Multi-valued functional dependencies are treated as
higher normal Form.
➢For ex, the employee entity set, the employee may
have several phone numbers, some of which may be
shared by multiple employees.
7.4 Functional-Dependency Theory
7.4.1 Closure of a Set of Functional Dependencies
Let F be a set of functional dependencies. The closure of
F, denoted by -F
+
, is the set of all functional dependencies
logically implied by F.
7.4 Functional-Dependency Theory
7.4.1 Closure of a Set of Functional Dependencies
The following three rules to find logically implied
functional dependencies. By applying these rules
repeatedly, we can find all of F+, given F. This collection
of rules is called Armstrong's axioms.
7.4 Functional-Dependency Theory
7.4.1 Closure of a Set of Functional Dependencies
To simplify the functional dependency, the additional list
of rules are given below:
7.4 Functional-Dependency Theory
7.4.1 Closure of a Set of Functional Dependencies
Figure 7.8 shows a procedure that demonstrates formally
how to use Armstrong's axioms to compute f+.
7.4 Functional-Dependency Theory
7.4.1 Closure of a Set of Functional Dependencies
➢Theleft-handandright-handsidesofafunctional
dependencyarebothsubsetsofR.
➢Sinceasetofsizenhas2
n
subsets,thereareatotalof
2
n
x2
n
:2
2n
possiblefunctionaldependencies,wheren
isthenumberofattributesinR.
➢Ifn=3,thenpossiblefunctionaldependenciesare
2*(2
2*3
)=128
7.4 Functional-Dependency Theory
7.4.4 Lossless Decomposition
7.6 Decomposition using Multivalued Dependencies
7.6.1 Multivalued Dependencies
7.6.2 Fourth Normal Form
7.6.2 Fourth Normal Form
Considerthebankingexample.Assumethat,inan
alternativedesignforthebankdatabaseschema,we
havetheschema
cust-loan:(loan-number,customer-id,customer-name,
customer-street,customer_city)
customer-id→customer_name,customer_street,
customer_city
customer-idisnotakeyforcust-Ioan.However,
assumethatourbankisattractingwealthycustomers
whohaveseveraladdresses(say,awinterhomeand
asummerhome).
7.6.2 Fourth Normal Form
➢Theaboverelationcontainsdataredundancy.The
functionaldependencydoesnotallowsthedata
redundancy.
➢Themultivalueddependencyallowsthedata
redundancy.Theaddressofeachresidenceofa
customeronceforeachloanthatcustomerhas.
➢TosolvethisproblembydecomposingRinto:
loancust-id=(loan-numebr,customer-id)
cust_residence=(customer-id,customer-street,
customer-city)
7.7 More Normal Forms
➢Thefourthnormalformisbynomeansthe
"ultimate"normalform.
➢Therearetwotypesofnormalformnamelyproject
joinnormalformanddomainkeynormalform
usinggeneralizedmultivalueddependency.
7.8.1 E-R Model and Normalization
➢IfthedatabasedesignerperfectlydesigntheER
modelthennoneedtogofornormalizationprocess.
➢Itisdifficulttoidentifythefunctionaldependency
fromtheERmodel.
➢Forinstance,supposeanemployeerelationhadan
attributesdepartment-numberanddepartment-
addressandthereisafunctionaldependency
department-number→department-address.
➢Inthissituation,Theemployeerelationshouldbe
normalized.
7.8.1 E-R Model and Normalization
➢Intheaboveexample,ifwehaddesignedtheE-R
diagramcorrectly,wewouldhavecreatedadepartment
relationwithattributedepartment-addressanda
relationshipbetweenemployeeanddepartment.
Before Normalization
Employee : Department-number, Department Address
After Normalization
Department : Department-number, Department Address
Employee: Department-number, Employee-no, Employee-
name
7.8.2 Naming of Attributes and Relationships
➢Eachattributenamehasauniquemeaninginthedatabase.
➢Theorderofattributenamesinaschemadoesnotmatter,
itisconventiontolistprimary-keyattributesfirst.
➢Inlargedatabaseschemas,relationshipsets(andschemas
derivedtherefrom)areoftennamedviaaconcatenationof
thenamesofrelatedentitysetswithhyphenorunderscore.
ForExample:loan_branch.
➢Differentorganizationshavedifferentconventionsfor
namingentities.Forexample,Theentitysetofcustomers
maycalleithercustomerorcustomers.Usingeither
singularorpluralisacceptable.