SlideShare a Scribd company logo
1 of 34
WEL COME
TO
OUR PRESENTATION
18/8/2017
PRESENTED
BY: Presented to:
Normalization & JOIN
28/8/2017
Md . Sohag
Em@il : sohag.0315@gmail.com
Daffodil international University
NORMALIZATION OF DATABASE
Database Normalization is a technique of organizing the data in the
database. Normalization is a systematic approach of decomposing
tables to eliminate data redundancy and undesirable characteristics like
Insertion, Update and Deletion Anomalies .
 Normalization is used for mainly two purpose
 Eliminating redundant(useless) data.
 The problem usually happens when an existing system uses unstructured file, e.g. in M
8/8/2017 3
PROBLEM WITHOUT NORMALIZATION
 Without Normalization, it becomes difficult to handle and update
the database, without facing data loss. Insertion, Updation and
Deletion Anomalies are very frequent if Database is not Normalized.
S_id S_Name S_Address Subject_opted
401 Adam Noida Bio
402 Alex Panipat Maths
403 Stuart Jammu Maths
404 Adam Noida Physics
8/8/2017 4
PROBLEM WITHOUT NORMALIZATION
 Updation Anomaly
 Insertion Anomaly
 Deletion Anomaly
S_id S_Name S_Address Subject_opted
401 Adam Noida Bio
402 Alex Panipat Maths
403 Stuart Jammu Maths
404 Adam Noida Physics
8/8/2017 5
NORMALIZATION RULE
 Normalization rule are divided into following normal
form :
 First Normal Form
 Second Normal Form
 Third Normal Form
8/8/2017 6
FIRST NORMAL FORM(1NF)
THE OFFICIAL QUALIFICATIONS FOR 1NF ARE:
1. Each Attribute Name Must Be Unique.
2. Each Attribute Value Must Be Single.
3. Each Row Must Be Unique.
4. There Is No Repeating Groups.
78/8/2017
FIRST NORMAL FORM(1NF)
8
Example of a table not in 1NF :
 It violates the 1NF.
Student Age Subject
Adam 15 Biology, Maths
Alex 14 Maths
Stuart 17 Maths
8/8/2017
FIRST NORMAL FORM (1NF)
9
 Now it is in 1NF.
 However, it might still violate 2NF and so on.
Student Age Subject
Adam 15 Biology
Adam 15 Maths
Alex 14 Maths
Stuart 17 Maths
8/8/2017
FUNCTIONAL DEPENDENCIES
10
We say an attribute, B, has a functional dependency on another attribute, A, if for any two
records, which have
the same value for A, then the values for B in these two records must be the same. We
illustrate this as:
A  B (read as: A determines B or B depends on A)
employee name  email address
employee name project email address
Sok San POS Mart Sys soksan@yahoo.com
Sao Ry Univ Mgt Sys sao@yahoo.com
Sok San Web Redesign soksan@yahoo.com
Chan Sokna POS Mart Sys chan@gmail.com
Sao Ry DB Design sao@yahoo.com
8/8/2017
FUNCTIONAL DEPENDENCIES
11
EmpNum EmpEmail EmpFname EmpLname
123 jdoe@abc.com John Doe
456 psmith@abc.com Peter Smith
555 alee1@abc.com Alan Lee
633 pdoe@abc.com Peter Doe
787 alee2@abc.com Alan Lee
If EmpNum is the PK then the FDs:
EmpNum  EmpEmail, EmpFname, EmpLname
must exist.
8/8/2017
FUNCTIONAL DEPENDENCIES
12
EmpNum  EmpEmail, EmpFname, EmpLname
EmpNum
EmpEmail
EmpFname
EmpLname
EmpNum EmpEmail EmpFname EmpLname
8/8/2017
DETERMINANT
13
Functional Dependency
EmpNum  EmpEmail
Attribute on the left hand side is known as the
determinant
• EmpNum is a determinant of EmpEmail
8/8/2017
SECOND NORMAL FORM(2NF)
THE OFFICIAL QUALIFICATIONS FOR 2NF
ARE:
1. A TABLE IS ALREADY IN 1NF.
2. ALL NONKEY ATTRIBUTES ARE FULLY DEPENDENT ON THE PRIMARY KEY.
ALL PARTIAL DEPENDENCIES ARE REMOVED TO PLACE IN ANOTHER TABLE.
128/8/2017
CourseID SemesterID Num Student Course Name
IT101 201301 25 Database
IT101 201302 25 Database
IT102 201301 30 Web Prog
IT102 201302 35 Web Prog
IT103 201401 20 Networking
Example of a table not in 2NF:
Primary Key
The Course Name depends on only CourseID, a part of the primary key
not the whole primary {CourseID, SemesterID}.It’s called partial
dependency.
15
SECOND NORMAL FORM(2NF)
8/8/2017
CourseID Course Name
IT101 Database
IT101 Database
IT102 Web Prog
IT102 Web Prog
IT103 Networking
SemesterDone? Oh no, it is still
not in 1NF yet.
Remove the repeating
groups too.
Finally, connect the
relationship.
CourseID Course Name
IT101 Database
IT102 Web Prog
IT103 Networking
CourseID SemesterID Num Student
IT101 201301 25
IT101 201302 25
IT102 201301 30
IT102 201302 35
IT103 201401 20
16
SECOND NORMAL FORM(2NF)
8/8/2017
THIRD NORMAL FORM (3NF)
THE OFFICIAL QUALIFICATIONS FOR 3NF ARE:
1. A TABLE IS ALREADY IN 2NF.
2. NONPRIMARY KEY ATTRIBUTES DO NOT DEPEND ON OTHER NONPRIMARY
KEY ATTRIBUTES
178/8/2017
StudyID Course Name Teacher Name Teacher Tel
1 Database Sok Piseth 012 123 456
2 Database Sao Kanha 0977 322 111
3 Web Prog Chan Veasna 012 412 333
4 Web Prog Chan Veasna 012 412 333
5 Networking Pou Sambath 077 545 221
Example of a Table not in 3NF:
Primary Key
18
THIRD NORMAL FORM (3NF)
8/8/2017
Teacher Name Teacher Tel
Sok Piseth 012 123 456
Sao Kanha 0977 322 111
Chan Veasna 012 412 333
Chan Veasna 012 412 333
Pou Sambath 077 545 221
Done?
Oh no, it is still not in 1NF yet.
Remove Repeating row.
Teacher Name Teacher Tel
Sok Piseth 012 123 456
Sao Kanha 0977 322 111
Chan Veasna 012 412 333
Pou Sambath 077 545 221
Note about primary key:
- In theory, you can choose
Teacher Name to be a primary key.
- But in practice, you should add
Teacher ID as the primary key.
ID Teacher Name Teacher Tel
T1 Sok Piseth 012 123 456
T2 Sao Kanha 0977 322
111
T3 Chan Veasna 012 412 333
T4 Pou Sambath 077 545 221
StudyID Course Name T.ID
1 Database T1
2 Database T2
3 Web Prog T3
4 Web Prog T3
5 Networking T4
198/8/2017
JOIN
 Join Is A Special Form Of Cross Product
Of Two Tables.
 In Cartesian Product We Join A Tuple Of
One Table With The Tuples Of The
Second Table. But In Join There Is A
Special Requirement Of Relationship
Between Tuples.
8/8/2017 20
JOIN TYPES
SQL JOIN
Inner
Join
Outer
Join
Self Join
Cross
Join
Theta Join
Equi Join
Natural
Join
Left Outer JOIN
Right Outer
JOIN
Full Outer JOIN 8/8/2017 21
INNER JOIN
AN INNER JOIN IS THE MOST COMMON JOIN OPERATION USED IN
APPLICATIONS AND CAN BE REGARDED AS THE DEFAULT JOIN-
TYPE.
 INNER JOIN CREATES A NEW RESULT TABLE BY COMBINING
COLUMN VALUES OF TWO TABLES (A AND B) BASED UPON THE
JOIN-PREDICATE.
8/8/2017 22
Θ-JOIN
CONSIDER TABLES CAR AND BOAT WHICH LIST MODELS OF CARS
AND BOATS AND THEIR RESPECTIVE PRICES.
 SUPPOSE A CUSTOMER WANTS TO BUY A CAR AND A BOAT, BUT
SHE DOES NOT WANT TO SPEND MORE MONEY FOR THE BOAT
THAN FOR THE CAR.
8/8/2017 23
EQUI JOIN
AN EQUI-JOIN, ALSO KNOWN AS AN EQUIJOIN, IS A SPECIFIC TYPE
OF COMPARATOR-BASED JOIN, OR THETA JOIN, THAT USES
ONLY EQUALITY COMPARISONS IN THE JOIN-PREDICATE. USING
OTHER COMPARISON OPERATORS (SUCH AS <) DISQUALIFIES A
JOIN AS AN EQUI-JOIN.
8/8/2017 24
EQUI JOIN EXAMPLE
8/8/2017 25
NATURAL JOIN
NATURAL JOIN ( ) IS A BINARY OPERATOR THAT IS WRITTEN AS
(R S) WHERE R AND S ARE RELATIONS.
 IN PARTICULAR, NATURAL JOIN ALLOWS THE COMBINATION OF
RELATIONS THAT ARE ASSOCIATED BY A FOREIGN KEY.
8/8/2017 26
OUTER JOIN
 An Outer Join Does Not Require Each Record In The Two Joined
Tables To Have A Matching Record. The Joined Table Retains Each
Record—even If No Other Matching Record Exists.
8/8/2017 27
LEFT OUTER JOIN
The Result Of A Left Outer Join (Or Simply Left Join) For Table A And B Always
Contains All Records Of The "Left" Table (A), Even If The Join-condition Does
Not Find Any Matching Record In The "Right" Table (B).
Employee
Dept
Employee =X Dept
8/8/2017 28
LEFT OUTER JOIN EXAMPLE
8/8/2017 29
RIGHT OUTER JOIN
A RIGHT OUTER JOIN (OR RIGHT JOIN) CLOSELY RESEMBLES A LEFT OUTER JOIN,
EXCEPT WITH THE TREATMENT OF THE TABLES REVERSED
Employee X= Dept
Employee
Dept
8/8/2017 30
RIGHT OUTER JOIN EXAMPLE
8/8/2017 31
FULL OUTER JOIN
Conceptually, A Full Outer Join Combines The Effect Of Applying Both Left And
Right Outer Joins.
Employee =X= Dept
Employee
Dept
8/8/2017 32
FULL OUTER JOIN (EXAMPLE)
8/8/2017 33
8/8/2017 34

More Related Content

What's hot

Executive Information System
Executive Information SystemExecutive Information System
Executive Information System
Theju Paul
 

What's hot (20)

University Database Management Project
University Database Management Project University Database Management Project
University Database Management Project
 
DBMS - Database Management System
DBMS - Database Management System DBMS - Database Management System
DBMS - Database Management System
 
Basic SQL and History
 Basic SQL and History Basic SQL and History
Basic SQL and History
 
Type Checking
Type CheckingType Checking
Type Checking
 
Library Management System Project
Library Management System ProjectLibrary Management System Project
Library Management System Project
 
Design Effective Input Chapter 12
Design Effective Input Chapter 12Design Effective Input Chapter 12
Design Effective Input Chapter 12
 
Dbms and sqlpptx
Dbms and sqlpptxDbms and sqlpptx
Dbms and sqlpptx
 
information system
information systeminformation system
information system
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Relational keys
Relational keysRelational keys
Relational keys
 
Using the set operators
Using the set operatorsUsing the set operators
Using the set operators
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
 
Normal forms
Normal formsNormal forms
Normal forms
 
Database approach
Database approachDatabase approach
Database approach
 
Entity Relationship Diagram of Library System
Entity Relationship Diagram of Library SystemEntity Relationship Diagram of Library System
Entity Relationship Diagram of Library System
 
Null values, insert, delete and update in database
Null values, insert, delete and update in databaseNull values, insert, delete and update in database
Null values, insert, delete and update in database
 
Executive Information System
Executive Information SystemExecutive Information System
Executive Information System
 
Sql operators & functions 3
Sql operators & functions 3Sql operators & functions 3
Sql operators & functions 3
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
 

Similar to Normalization & join

1 Exploratory Data Analysis (EDA) by Melvin Ott, PhD.docx
1 Exploratory Data Analysis (EDA) by Melvin Ott, PhD.docx1 Exploratory Data Analysis (EDA) by Melvin Ott, PhD.docx
1 Exploratory Data Analysis (EDA) by Melvin Ott, PhD.docx
honey725342
 
final home work for database.DS_Store__MACOSXfinal home wo.docx
final home work for database.DS_Store__MACOSXfinal home wo.docxfinal home work for database.DS_Store__MACOSXfinal home wo.docx
final home work for database.DS_Store__MACOSXfinal home wo.docx
mydrynan
 
Web Quest Baseball
Web Quest BaseballWeb Quest Baseball
Web Quest Baseball
cubsfan3371
 
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptxICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
Amanda783100
 
1Copyright © 2014 Pearson Education, Inc. Publishing as Pren.docx
1Copyright © 2014 Pearson Education, Inc. Publishing as Pren.docx1Copyright © 2014 Pearson Education, Inc. Publishing as Pren.docx
1Copyright © 2014 Pearson Education, Inc. Publishing as Pren.docx
hyacinthshackley2629
 

Similar to Normalization & join (20)

Sql Server 2000
Sql Server 2000Sql Server 2000
Sql Server 2000
 
Normalization in Database Management System.pptx
Normalization in Database Management System.pptxNormalization in Database Management System.pptx
Normalization in Database Management System.pptx
 
Normalization
NormalizationNormalization
Normalization
 
1 Exploratory Data Analysis (EDA) by Melvin Ott, PhD.docx
1 Exploratory Data Analysis (EDA) by Melvin Ott, PhD.docx1 Exploratory Data Analysis (EDA) by Melvin Ott, PhD.docx
1 Exploratory Data Analysis (EDA) by Melvin Ott, PhD.docx
 
Presentation on SQL At Batra Computer Cente
Presentation on SQL At Batra Computer CentePresentation on SQL At Batra Computer Cente
Presentation on SQL At Batra Computer Cente
 
Preparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001dPreparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001d
 
final home work for database.DS_Store__MACOSXfinal home wo.docx
final home work for database.DS_Store__MACOSXfinal home wo.docxfinal home work for database.DS_Store__MACOSXfinal home wo.docx
final home work for database.DS_Store__MACOSXfinal home wo.docx
 
CSCI 4140-AA Pre-Req.ppt
CSCI 4140-AA Pre-Req.pptCSCI 4140-AA Pre-Req.ppt
CSCI 4140-AA Pre-Req.ppt
 
Ms office excel
Ms office excelMs office excel
Ms office excel
 
SAS/Tableau integration
SAS/Tableau integrationSAS/Tableau integration
SAS/Tableau integration
 
Chapter5.pptx
Chapter5.pptxChapter5.pptx
Chapter5.pptx
 
Web Quest Baseball
Web Quest BaseballWeb Quest Baseball
Web Quest Baseball
 
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptxICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
 
Sql Lab 4 Essay
Sql Lab 4 EssaySql Lab 4 Essay
Sql Lab 4 Essay
 
Unit-3-SQL-part1.ppt
Unit-3-SQL-part1.pptUnit-3-SQL-part1.ppt
Unit-3-SQL-part1.ppt
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
 
Chapter 4 notes DBMS.pdf
Chapter 4 notes DBMS.pdfChapter 4 notes DBMS.pdf
Chapter 4 notes DBMS.pdf
 
SQL and E R diagram
SQL and E R diagramSQL and E R diagram
SQL and E R diagram
 
Intro to SQL for Beginners
Intro to SQL for BeginnersIntro to SQL for Beginners
Intro to SQL for Beginners
 
1Copyright © 2014 Pearson Education, Inc. Publishing as Pren.docx
1Copyright © 2014 Pearson Education, Inc. Publishing as Pren.docx1Copyright © 2014 Pearson Education, Inc. Publishing as Pren.docx
1Copyright © 2014 Pearson Education, Inc. Publishing as Pren.docx
 

More from Sohag Babu (13)

Dead Lock
Dead LockDead Lock
Dead Lock
 
Twisted pair cable
Twisted pair cableTwisted pair cable
Twisted pair cable
 
Software testing lifecycle
Software testing lifecycleSoftware testing lifecycle
Software testing lifecycle
 
Social networking
Social networkingSocial networking
Social networking
 
Simple web browser
Simple web browserSimple web browser
Simple web browser
 
Regression analysis
Regression analysisRegression analysis
Regression analysis
 
Presentation of transistor
Presentation of transistorPresentation of transistor
Presentation of transistor
 
Hamilton paths and circuit
Hamilton paths and circuitHamilton paths and circuit
Hamilton paths and circuit
 
E learning
E learningE learning
E learning
 
Applications of differential equations
Applications of differential equationsApplications of differential equations
Applications of differential equations
 
Application of numerical methods
Application of numerical methodsApplication of numerical methods
Application of numerical methods
 
Application layer
Application layerApplication layer
Application layer
 
4th generation computer
4th generation computer4th generation computer
4th generation computer
 

Recently uploaded

Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 

Recently uploaded (20)

Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 

Normalization & join

  • 2. PRESENTED BY: Presented to: Normalization & JOIN 28/8/2017 Md . Sohag Em@il : sohag.0315@gmail.com Daffodil international University
  • 3. NORMALIZATION OF DATABASE Database Normalization is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion, Update and Deletion Anomalies .  Normalization is used for mainly two purpose  Eliminating redundant(useless) data.  The problem usually happens when an existing system uses unstructured file, e.g. in M 8/8/2017 3
  • 4. PROBLEM WITHOUT NORMALIZATION  Without Normalization, it becomes difficult to handle and update the database, without facing data loss. Insertion, Updation and Deletion Anomalies are very frequent if Database is not Normalized. S_id S_Name S_Address Subject_opted 401 Adam Noida Bio 402 Alex Panipat Maths 403 Stuart Jammu Maths 404 Adam Noida Physics 8/8/2017 4
  • 5. PROBLEM WITHOUT NORMALIZATION  Updation Anomaly  Insertion Anomaly  Deletion Anomaly S_id S_Name S_Address Subject_opted 401 Adam Noida Bio 402 Alex Panipat Maths 403 Stuart Jammu Maths 404 Adam Noida Physics 8/8/2017 5
  • 6. NORMALIZATION RULE  Normalization rule are divided into following normal form :  First Normal Form  Second Normal Form  Third Normal Form 8/8/2017 6
  • 7. FIRST NORMAL FORM(1NF) THE OFFICIAL QUALIFICATIONS FOR 1NF ARE: 1. Each Attribute Name Must Be Unique. 2. Each Attribute Value Must Be Single. 3. Each Row Must Be Unique. 4. There Is No Repeating Groups. 78/8/2017
  • 8. FIRST NORMAL FORM(1NF) 8 Example of a table not in 1NF :  It violates the 1NF. Student Age Subject Adam 15 Biology, Maths Alex 14 Maths Stuart 17 Maths 8/8/2017
  • 9. FIRST NORMAL FORM (1NF) 9  Now it is in 1NF.  However, it might still violate 2NF and so on. Student Age Subject Adam 15 Biology Adam 15 Maths Alex 14 Maths Stuart 17 Maths 8/8/2017
  • 10. FUNCTIONAL DEPENDENCIES 10 We say an attribute, B, has a functional dependency on another attribute, A, if for any two records, which have the same value for A, then the values for B in these two records must be the same. We illustrate this as: A  B (read as: A determines B or B depends on A) employee name  email address employee name project email address Sok San POS Mart Sys soksan@yahoo.com Sao Ry Univ Mgt Sys sao@yahoo.com Sok San Web Redesign soksan@yahoo.com Chan Sokna POS Mart Sys chan@gmail.com Sao Ry DB Design sao@yahoo.com 8/8/2017
  • 11. FUNCTIONAL DEPENDENCIES 11 EmpNum EmpEmail EmpFname EmpLname 123 jdoe@abc.com John Doe 456 psmith@abc.com Peter Smith 555 alee1@abc.com Alan Lee 633 pdoe@abc.com Peter Doe 787 alee2@abc.com Alan Lee If EmpNum is the PK then the FDs: EmpNum  EmpEmail, EmpFname, EmpLname must exist. 8/8/2017
  • 12. FUNCTIONAL DEPENDENCIES 12 EmpNum  EmpEmail, EmpFname, EmpLname EmpNum EmpEmail EmpFname EmpLname EmpNum EmpEmail EmpFname EmpLname 8/8/2017
  • 13. DETERMINANT 13 Functional Dependency EmpNum  EmpEmail Attribute on the left hand side is known as the determinant • EmpNum is a determinant of EmpEmail 8/8/2017
  • 14. SECOND NORMAL FORM(2NF) THE OFFICIAL QUALIFICATIONS FOR 2NF ARE: 1. A TABLE IS ALREADY IN 1NF. 2. ALL NONKEY ATTRIBUTES ARE FULLY DEPENDENT ON THE PRIMARY KEY. ALL PARTIAL DEPENDENCIES ARE REMOVED TO PLACE IN ANOTHER TABLE. 128/8/2017
  • 15. CourseID SemesterID Num Student Course Name IT101 201301 25 Database IT101 201302 25 Database IT102 201301 30 Web Prog IT102 201302 35 Web Prog IT103 201401 20 Networking Example of a table not in 2NF: Primary Key The Course Name depends on only CourseID, a part of the primary key not the whole primary {CourseID, SemesterID}.It’s called partial dependency. 15 SECOND NORMAL FORM(2NF) 8/8/2017
  • 16. CourseID Course Name IT101 Database IT101 Database IT102 Web Prog IT102 Web Prog IT103 Networking SemesterDone? Oh no, it is still not in 1NF yet. Remove the repeating groups too. Finally, connect the relationship. CourseID Course Name IT101 Database IT102 Web Prog IT103 Networking CourseID SemesterID Num Student IT101 201301 25 IT101 201302 25 IT102 201301 30 IT102 201302 35 IT103 201401 20 16 SECOND NORMAL FORM(2NF) 8/8/2017
  • 17. THIRD NORMAL FORM (3NF) THE OFFICIAL QUALIFICATIONS FOR 3NF ARE: 1. A TABLE IS ALREADY IN 2NF. 2. NONPRIMARY KEY ATTRIBUTES DO NOT DEPEND ON OTHER NONPRIMARY KEY ATTRIBUTES 178/8/2017
  • 18. StudyID Course Name Teacher Name Teacher Tel 1 Database Sok Piseth 012 123 456 2 Database Sao Kanha 0977 322 111 3 Web Prog Chan Veasna 012 412 333 4 Web Prog Chan Veasna 012 412 333 5 Networking Pou Sambath 077 545 221 Example of a Table not in 3NF: Primary Key 18 THIRD NORMAL FORM (3NF) 8/8/2017
  • 19. Teacher Name Teacher Tel Sok Piseth 012 123 456 Sao Kanha 0977 322 111 Chan Veasna 012 412 333 Chan Veasna 012 412 333 Pou Sambath 077 545 221 Done? Oh no, it is still not in 1NF yet. Remove Repeating row. Teacher Name Teacher Tel Sok Piseth 012 123 456 Sao Kanha 0977 322 111 Chan Veasna 012 412 333 Pou Sambath 077 545 221 Note about primary key: - In theory, you can choose Teacher Name to be a primary key. - But in practice, you should add Teacher ID as the primary key. ID Teacher Name Teacher Tel T1 Sok Piseth 012 123 456 T2 Sao Kanha 0977 322 111 T3 Chan Veasna 012 412 333 T4 Pou Sambath 077 545 221 StudyID Course Name T.ID 1 Database T1 2 Database T2 3 Web Prog T3 4 Web Prog T3 5 Networking T4 198/8/2017
  • 20. JOIN  Join Is A Special Form Of Cross Product Of Two Tables.  In Cartesian Product We Join A Tuple Of One Table With The Tuples Of The Second Table. But In Join There Is A Special Requirement Of Relationship Between Tuples. 8/8/2017 20
  • 21. JOIN TYPES SQL JOIN Inner Join Outer Join Self Join Cross Join Theta Join Equi Join Natural Join Left Outer JOIN Right Outer JOIN Full Outer JOIN 8/8/2017 21
  • 22. INNER JOIN AN INNER JOIN IS THE MOST COMMON JOIN OPERATION USED IN APPLICATIONS AND CAN BE REGARDED AS THE DEFAULT JOIN- TYPE.  INNER JOIN CREATES A NEW RESULT TABLE BY COMBINING COLUMN VALUES OF TWO TABLES (A AND B) BASED UPON THE JOIN-PREDICATE. 8/8/2017 22
  • 23. Θ-JOIN CONSIDER TABLES CAR AND BOAT WHICH LIST MODELS OF CARS AND BOATS AND THEIR RESPECTIVE PRICES.  SUPPOSE A CUSTOMER WANTS TO BUY A CAR AND A BOAT, BUT SHE DOES NOT WANT TO SPEND MORE MONEY FOR THE BOAT THAN FOR THE CAR. 8/8/2017 23
  • 24. EQUI JOIN AN EQUI-JOIN, ALSO KNOWN AS AN EQUIJOIN, IS A SPECIFIC TYPE OF COMPARATOR-BASED JOIN, OR THETA JOIN, THAT USES ONLY EQUALITY COMPARISONS IN THE JOIN-PREDICATE. USING OTHER COMPARISON OPERATORS (SUCH AS <) DISQUALIFIES A JOIN AS AN EQUI-JOIN. 8/8/2017 24
  • 26. NATURAL JOIN NATURAL JOIN ( ) IS A BINARY OPERATOR THAT IS WRITTEN AS (R S) WHERE R AND S ARE RELATIONS.  IN PARTICULAR, NATURAL JOIN ALLOWS THE COMBINATION OF RELATIONS THAT ARE ASSOCIATED BY A FOREIGN KEY. 8/8/2017 26
  • 27. OUTER JOIN  An Outer Join Does Not Require Each Record In The Two Joined Tables To Have A Matching Record. The Joined Table Retains Each Record—even If No Other Matching Record Exists. 8/8/2017 27
  • 28. LEFT OUTER JOIN The Result Of A Left Outer Join (Or Simply Left Join) For Table A And B Always Contains All Records Of The "Left" Table (A), Even If The Join-condition Does Not Find Any Matching Record In The "Right" Table (B). Employee Dept Employee =X Dept 8/8/2017 28
  • 29. LEFT OUTER JOIN EXAMPLE 8/8/2017 29
  • 30. RIGHT OUTER JOIN A RIGHT OUTER JOIN (OR RIGHT JOIN) CLOSELY RESEMBLES A LEFT OUTER JOIN, EXCEPT WITH THE TREATMENT OF THE TABLES REVERSED Employee X= Dept Employee Dept 8/8/2017 30
  • 31. RIGHT OUTER JOIN EXAMPLE 8/8/2017 31
  • 32. FULL OUTER JOIN Conceptually, A Full Outer Join Combines The Effect Of Applying Both Left And Right Outer Joins. Employee =X= Dept Employee Dept 8/8/2017 32
  • 33. FULL OUTER JOIN (EXAMPLE) 8/8/2017 33