SlideShare une entreprise Scribd logo
1  sur  30
STRUCTURED SYSTEM
ANALYSIS AND DESIGN
CHP 6. DATABASE DESIGN
MR. JAYANT. P. DALVI
DATABASE CONCEPTS
• Data: collection of raw facts
• Information: conversion of data into it after processing
• Database: collection of data in form of tables(rows and
columns)
• primary key: It is the first key which is used to identify one
and only one instance of an entity uniquely.
• Foreign key:
• Foreign keys are the column of the table which is used to
point to the primary key of another table.
• In a company, every employee works in a specific
department, and employee and department are two
different entities. So we can't store the information of the
department in the employee table. That's why we link
these two tables through the primary key of one table.
• We add the primary key of the DEPARTMENT table,
Department_Id as a new attribute in the EMPLOYEE table.
• Now in the EMPLOYEE table, Department_Id is the foreign
key, and both the tables are related.
NEED OF DATABASE DESIGN
• For any organization a bit complex and challenging task is to analyze
and organize the data in required format which becomes database
design for the system.
• It requires technical database design methods such as Entity
modeling method and Normalization which helps to put every datA of
data structure in its perspective and provides neat and well defined &
designed database.
• Entity:-Everything that is having individual existence which can be
recognized by its characteristics is called as entity.
• Characteristics or properties of an entity represent its attributes.
ER MODEL
• Rules For E-R Model:
Every entity must be represented in the model.
Every entity must have at least one relationship{1-1,1-m,m-n}
Every entity must have a unique identifier.
Many to many relationships are to be avoided.
Entity models are logical, not physical; they represent logical groups of data
Called entities and the relationships between the entities.
The technique complements data flow diagram.
Note that many to many relationships can be split as N-1 &1-M relationships.
Illustrative Case For E-R Model
• Draw E-R diagram for the computer course conducted for the
students which involves some compulsory subjects and some
optional subjects. Students refer different books for studying those
subjects.
• Solution:
• Entities: course, students, subjects, books
• Relationships: 1) course counducted for students
2) course includes subjects
3) students refer books
4) subjects have books
Attributes of Entities
1) Course Table: course_no, course_name, University_name,
2) Subject Table: sub_no, Sub_name,
3)Students Table: stu_no, Stu_name, address
4) Books Table: book_no, book_name,
ER DIAGRAM OF CASE STUDY
Mapping E-R to Table
1] Each entity is mapped into a table. The name of the entity becomes the name of the table.
2] The attributes of the entity becomes the fields of the table.
3] The key attribute of the entity becomes the primary key of the table.
4] The table which is mapped from the weak entity will have the key attribute of weak
entity and also have the key attribute of the strong entity on what it depends. This
attribute is known as foreign key.
5] In case of 1: m relationship the entity having the ‘m’ relationship borrows the key
attribute from the ‘1’ relationship.
In illustrative case:
1] Course table {strong entity}: course no (pk), course –nm, uni-nm, sub_no(fk), stu_nm(fk)
2] Student table {weak entity}: stu-id (Pk), stu-nm, stu-add, ph-no, course-no (fk), sub_no(fk).
3] Subject table: sub-cd (pk), sub-nm, cors-cd, book-pres-no, stu-id (fk).
4] Book table: Book-no (pk), book-nm, sub-cd (fk),course_no(fk).
CONVERSION OF E-R DIAGRAM TO E-R DATA
MODEL
• To convert E-R diagram to setoff relationship (E-R data model) we
replace each set in E-R diagram by a table. Thus each entity set and
each relationship set becomes a table or relation, the name of the set
becomes the name of the table and the attributes of the set become
the table columns.
WHAT IS NORMALIZATION?
• Normalization is the decomposition of complex data structures into ‘flat files’ called
relations. Decomposition refers to the breaking down of one table into multiple tables.
• The main difference between decomposition and normalization is that decomposition
can not be used for redundancy if it leads loss of information.
• If we are not able to take back the data in original forms means there is loss of
information from original database design. Normalization is not very different from
decomposition. The only difference between the two is that decomposition is not abide
by any formal rules, where as normalization does .
• When we apply a normalization rile the database design takes the next original form
called the normal form
NORMALIZATION
• Normalization is the process of organizing the data in the database.
• Normalization is used to minimize the redundancy from a relation or
set of relations. It is also used to eliminate the undesirable
characteristics like Insertion, Update and Deletion Anomalies.
• Normalization divides the larger table into the smaller table and links
them using relationship.
• The normal form is used to reduce redundancy from the database
table.
WHY IS NORMALIZATION NECESSARY?
• Following Normalization is necessary to structure the data for
following reasons
1. Data structure should be easily understood by user.
2. New data items, records and associations can be added to the data
structure
without changing the existing structure.
3. It provides maximum flexibility to different levels of users to handle
the queries.
4. To provide maximum flexibility and ease for data maintenance.
LEVELS OF NORMALIZATION
• We are going to focus mainly three levels of normalization:
1. 1NF: First normal form – It is data structure without internal
repeating groups.
2. 2NF: Second normal form- It is data structure in which all non key
elements are fully and functionally dependent on the primary key.
3. 3NF: Third normal form- Third normal form eliminates transitive
dependencies. That is the dependencies of some non key elements on
other non key elements.
Illustrative Case study
• Consider a case where a order is placed by a customer for some
items. Order is fulfilled and on the basis of rate & quantity bill is
generated. Now for this case the data in raw state that is in un -
normalized form is as follows: Ord-no,ord-dt,cust-no,cust-nm,cust-
add,item-no,item-nm,rate,qty,amt,fax.
DATABASE TABLES
1] 1NF:- In first normal form we eliminate repeating data groups, means
redundancy is eliminated.
• This is the case of decomposition of
data where we loose the data due to
lack of integrity, since there is no
commonality between two tables.
So we can add another column to
second table so that item sold can
be linked up with particular order.
Thus referential integrity
relationship is achieved .In simple
words adding the joining column to
another table means foreign key. SO
modified table structure is as follows
2] 2NF: In second normal form , we move all columns to another table that do
not fully and functionally depend on primary key. So now the data in 2NF form
is as follows
3) 3NF: For 3NF transitive dependencies are eliminated. To find out the non key
elements depending upon some other no key elements, extract the elements which can
be directly calculated. In this case we can get rid of the field amt which can be
calculated with the help of rate and quantity. So the data structure in 3 NF Form is
FINAL DATABASE TABLES AFTER NORMALIZATION
EXAMPLE OF NORMALIZATION: 1NF
• A relation will be 1NF if it contains
an atomic value.
• It states that an attribute of a table
cannot hold multiple values. It must
hold only single-valued attribute.
• First normal form disallows the
multi-valued attribute, composite
attribute, and their combinations.
• Example: Relation EMPLOYEE is not
in 1NF because of multi-valued
attribute EMP_PHONE.
1NF
Second Normal Form (2NF)
• In the 2NF, relational must be in 1NF.
• In the second normal form, all non-key
attributes are fully functional dependent on
the primary key
• Example: Let's assume, a school can store the
data of teachers and the subjects they teach.
In a school, a teacher can teach more than
one subject.
• In the given table, non-prime attribute
TEACHER_AGE is dependent on TEACHER_ID
which is a proper subset of a candidate key.
That's why it violates the rule for 2NF.
2NF
Third Normal Form (3NF)
• A relation will be in 3NF if it is in 2NF and not contain any transitive partial
dependency.
• 3NF is used to reduce the data duplication. It is also used to achieve the data
integrity.
• If there is no transitive dependency for non-prime attributes, then the relation
must be in third normal form.
• A relation is in third normal form if it holds atleast one of the following
conditions for every non-trivial function dependency X → Y.
• X is a super key.
• Y is a prime attribute, i.e., each element of Y is part of some candidate key.
3NF
3NF
• Super key in the table above:
• {EMP_ID}, {EMP_ID, EMP_NAME}, {EMP_ID, EMP_NAME, EMP_ZIP}....so on
• Candidate key: {EMP_ID}
• Non-prime attributes: In the given table, all attributes except EMP_ID are non-prime.
• Here, EMP_STATE & EMP_CITY dependent on EMP_ZIP and EMP_ZIP dependent on EMP_ID. The non-prime
attributes (EMP_STATE, EMP_CITY) transitively dependent on super key(EMP_ID). It violates the rule of third
normal form.
• That's why we need to move the EMP_CITY and EMP_STATE to the new <EMPLOYEE_ZIP> table, with EMP_ZIP as a
Primary key.
Structured system analysis and design

Contenu connexe

Tendances

The relational database model chapter 2
The relational database model  chapter 2The relational database model  chapter 2
The relational database model chapter 2
Nargis Ehsan
 
Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4
Farhan Chishti
 
Normalization
NormalizationNormalization
Normalization
lingesan
 
Lecture 07 relational database management system
Lecture 07 relational database management systemLecture 07 relational database management system
Lecture 07 relational database management system
emailharmeet
 
Penormalan/Normalization
Penormalan/NormalizationPenormalan/Normalization
Penormalan/Normalization
Joan Ador
 

Tendances (20)

The relational database model chapter 2
The relational database model  chapter 2The relational database model  chapter 2
The relational database model chapter 2
 
Chapter-3 Data Modeling using ER Model
Chapter-3 Data Modeling using ER ModelChapter-3 Data Modeling using ER Model
Chapter-3 Data Modeling using ER Model
 
Relational model
Relational modelRelational model
Relational model
 
Chapter-6 Relational Algebra
Chapter-6 Relational AlgebraChapter-6 Relational Algebra
Chapter-6 Relational Algebra
 
Relational model
Relational modelRelational model
Relational model
 
Normalization
NormalizationNormalization
Normalization
 
Relational Model - An Introduction
Relational Model - An IntroductionRelational Model - An Introduction
Relational Model - An Introduction
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Normalization
NormalizationNormalization
Normalization
 
Lecture 07 relational database management system
Lecture 07 relational database management systemLecture 07 relational database management system
Lecture 07 relational database management system
 
Database - Normalization
Database - NormalizationDatabase - Normalization
Database - Normalization
 
Unit I Database concepts - RDBMS & ORACLE
Unit I  Database concepts - RDBMS & ORACLEUnit I  Database concepts - RDBMS & ORACLE
Unit I Database concepts - RDBMS & ORACLE
 
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
 
Penormalan/Normalization
Penormalan/NormalizationPenormalan/Normalization
Penormalan/Normalization
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
Sppt chap007
Sppt chap007Sppt chap007
Sppt chap007
 
Sql interview q&a
Sql interview q&aSql interview q&a
Sql interview q&a
 

Similaire à Structured system analysis and design

Dependencies in various topics like normalisation and its types
Dependencies in various topics like normalisation and its typesDependencies in various topics like normalisation and its types
Dependencies in various topics like normalisation and its types
nsrChowdary1
 
Database Management Systems 4 - Normalization
Database Management Systems 4 - NormalizationDatabase Management Systems 4 - Normalization
Database Management Systems 4 - Normalization
Nickkisha Farrell
 

Similaire à Structured system analysis and design (20)

DATABASE DESIGN.pptx
DATABASE DESIGN.pptxDATABASE DESIGN.pptx
DATABASE DESIGN.pptx
 
Data Modeling
Data ModelingData Modeling
Data Modeling
 
Normalization and three normal forms.pptx
Normalization and three normal forms.pptxNormalization and three normal forms.pptx
Normalization and three normal forms.pptx
 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
 
Assignment#11
Assignment#11Assignment#11
Assignment#11
 
Dependencies in various topics like normalisation and its types
Dependencies in various topics like normalisation and its typesDependencies in various topics like normalisation and its types
Dependencies in various topics like normalisation and its types
 
Ism normalization pine valley 2012
Ism normalization pine valley 2012Ism normalization pine valley 2012
Ism normalization pine valley 2012
 
Research gadot
Research gadotResearch gadot
Research gadot
 
1683368767418684.pdf
1683368767418684.pdf1683368767418684.pdf
1683368767418684.pdf
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptx
 
DATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEMDATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEM
 
UNIT II DBMS.pptx
UNIT II DBMS.pptxUNIT II DBMS.pptx
UNIT II DBMS.pptx
 
Distributed database
Distributed databaseDistributed database
Distributed database
 
Lecture 6.pptx
Lecture 6.pptxLecture 6.pptx
Lecture 6.pptx
 
Database Management Systems 4 - Normalization
Database Management Systems 4 - NormalizationDatabase Management Systems 4 - Normalization
Database Management Systems 4 - Normalization
 
databaess.pptx
databaess.pptxdatabaess.pptx
databaess.pptx
 
Normalization
NormalizationNormalization
Normalization
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
chapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdfchapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdf
 
Chapter Four Logical Database Design (Normalization).pptx
Chapter Four Logical Database Design (Normalization).pptxChapter Four Logical Database Design (Normalization).pptx
Chapter Four Logical Database Design (Normalization).pptx
 

Plus de Jayant Dalvi

Plus de Jayant Dalvi (16)

Linux System Administration
Linux System AdministrationLinux System Administration
Linux System Administration
 
Linux System Administration
Linux System AdministrationLinux System Administration
Linux System Administration
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
 
Java I/O
Java I/OJava I/O
Java I/O
 
Information system audit 2
Information system audit 2 Information system audit 2
Information system audit 2
 
java- Abstract Window toolkit
java- Abstract Window toolkitjava- Abstract Window toolkit
java- Abstract Window toolkit
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
 
Information system audit
Information system audit Information system audit
Information system audit
 
Information system audit
Information system audit Information system audit
Information system audit
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
 
Information system audit
Information system audit Information system audit
Information system audit
 
Multithreading in Java
Multithreading in JavaMultithreading in Java
Multithreading in Java
 
Exception handling c++
Exception handling c++Exception handling c++
Exception handling c++
 
Object Oriented Programming using C++
Object Oriented Programming using C++Object Oriented Programming using C++
Object Oriented Programming using C++
 

Dernier

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Dernier (20)

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Structured system analysis and design

  • 1. STRUCTURED SYSTEM ANALYSIS AND DESIGN CHP 6. DATABASE DESIGN MR. JAYANT. P. DALVI
  • 2. DATABASE CONCEPTS • Data: collection of raw facts • Information: conversion of data into it after processing • Database: collection of data in form of tables(rows and columns) • primary key: It is the first key which is used to identify one and only one instance of an entity uniquely. • Foreign key: • Foreign keys are the column of the table which is used to point to the primary key of another table. • In a company, every employee works in a specific department, and employee and department are two different entities. So we can't store the information of the department in the employee table. That's why we link these two tables through the primary key of one table. • We add the primary key of the DEPARTMENT table, Department_Id as a new attribute in the EMPLOYEE table. • Now in the EMPLOYEE table, Department_Id is the foreign key, and both the tables are related.
  • 3. NEED OF DATABASE DESIGN • For any organization a bit complex and challenging task is to analyze and organize the data in required format which becomes database design for the system. • It requires technical database design methods such as Entity modeling method and Normalization which helps to put every datA of data structure in its perspective and provides neat and well defined & designed database. • Entity:-Everything that is having individual existence which can be recognized by its characteristics is called as entity. • Characteristics or properties of an entity represent its attributes.
  • 4. ER MODEL • Rules For E-R Model: Every entity must be represented in the model. Every entity must have at least one relationship{1-1,1-m,m-n} Every entity must have a unique identifier. Many to many relationships are to be avoided. Entity models are logical, not physical; they represent logical groups of data Called entities and the relationships between the entities. The technique complements data flow diagram. Note that many to many relationships can be split as N-1 &1-M relationships.
  • 5. Illustrative Case For E-R Model • Draw E-R diagram for the computer course conducted for the students which involves some compulsory subjects and some optional subjects. Students refer different books for studying those subjects. • Solution: • Entities: course, students, subjects, books • Relationships: 1) course counducted for students 2) course includes subjects 3) students refer books 4) subjects have books
  • 6. Attributes of Entities 1) Course Table: course_no, course_name, University_name, 2) Subject Table: sub_no, Sub_name, 3)Students Table: stu_no, Stu_name, address 4) Books Table: book_no, book_name,
  • 7. ER DIAGRAM OF CASE STUDY
  • 8. Mapping E-R to Table 1] Each entity is mapped into a table. The name of the entity becomes the name of the table. 2] The attributes of the entity becomes the fields of the table. 3] The key attribute of the entity becomes the primary key of the table. 4] The table which is mapped from the weak entity will have the key attribute of weak entity and also have the key attribute of the strong entity on what it depends. This attribute is known as foreign key. 5] In case of 1: m relationship the entity having the ‘m’ relationship borrows the key attribute from the ‘1’ relationship. In illustrative case: 1] Course table {strong entity}: course no (pk), course –nm, uni-nm, sub_no(fk), stu_nm(fk) 2] Student table {weak entity}: stu-id (Pk), stu-nm, stu-add, ph-no, course-no (fk), sub_no(fk). 3] Subject table: sub-cd (pk), sub-nm, cors-cd, book-pres-no, stu-id (fk). 4] Book table: Book-no (pk), book-nm, sub-cd (fk),course_no(fk).
  • 9. CONVERSION OF E-R DIAGRAM TO E-R DATA MODEL • To convert E-R diagram to setoff relationship (E-R data model) we replace each set in E-R diagram by a table. Thus each entity set and each relationship set becomes a table or relation, the name of the set becomes the name of the table and the attributes of the set become the table columns.
  • 10.
  • 11.
  • 12.
  • 13. WHAT IS NORMALIZATION? • Normalization is the decomposition of complex data structures into ‘flat files’ called relations. Decomposition refers to the breaking down of one table into multiple tables. • The main difference between decomposition and normalization is that decomposition can not be used for redundancy if it leads loss of information. • If we are not able to take back the data in original forms means there is loss of information from original database design. Normalization is not very different from decomposition. The only difference between the two is that decomposition is not abide by any formal rules, where as normalization does . • When we apply a normalization rile the database design takes the next original form called the normal form
  • 14. NORMALIZATION • Normalization is the process of organizing the data in the database. • Normalization is used to minimize the redundancy from a relation or set of relations. It is also used to eliminate the undesirable characteristics like Insertion, Update and Deletion Anomalies. • Normalization divides the larger table into the smaller table and links them using relationship. • The normal form is used to reduce redundancy from the database table.
  • 15. WHY IS NORMALIZATION NECESSARY? • Following Normalization is necessary to structure the data for following reasons 1. Data structure should be easily understood by user. 2. New data items, records and associations can be added to the data structure without changing the existing structure. 3. It provides maximum flexibility to different levels of users to handle the queries. 4. To provide maximum flexibility and ease for data maintenance.
  • 16. LEVELS OF NORMALIZATION • We are going to focus mainly three levels of normalization: 1. 1NF: First normal form – It is data structure without internal repeating groups. 2. 2NF: Second normal form- It is data structure in which all non key elements are fully and functionally dependent on the primary key. 3. 3NF: Third normal form- Third normal form eliminates transitive dependencies. That is the dependencies of some non key elements on other non key elements.
  • 17. Illustrative Case study • Consider a case where a order is placed by a customer for some items. Order is fulfilled and on the basis of rate & quantity bill is generated. Now for this case the data in raw state that is in un - normalized form is as follows: Ord-no,ord-dt,cust-no,cust-nm,cust- add,item-no,item-nm,rate,qty,amt,fax.
  • 19. 1] 1NF:- In first normal form we eliminate repeating data groups, means redundancy is eliminated. • This is the case of decomposition of data where we loose the data due to lack of integrity, since there is no commonality between two tables. So we can add another column to second table so that item sold can be linked up with particular order. Thus referential integrity relationship is achieved .In simple words adding the joining column to another table means foreign key. SO modified table structure is as follows
  • 20. 2] 2NF: In second normal form , we move all columns to another table that do not fully and functionally depend on primary key. So now the data in 2NF form is as follows
  • 21. 3) 3NF: For 3NF transitive dependencies are eliminated. To find out the non key elements depending upon some other no key elements, extract the elements which can be directly calculated. In this case we can get rid of the field amt which can be calculated with the help of rate and quantity. So the data structure in 3 NF Form is
  • 22. FINAL DATABASE TABLES AFTER NORMALIZATION
  • 23. EXAMPLE OF NORMALIZATION: 1NF • A relation will be 1NF if it contains an atomic value. • It states that an attribute of a table cannot hold multiple values. It must hold only single-valued attribute. • First normal form disallows the multi-valued attribute, composite attribute, and their combinations. • Example: Relation EMPLOYEE is not in 1NF because of multi-valued attribute EMP_PHONE.
  • 24. 1NF
  • 25. Second Normal Form (2NF) • In the 2NF, relational must be in 1NF. • In the second normal form, all non-key attributes are fully functional dependent on the primary key • Example: Let's assume, a school can store the data of teachers and the subjects they teach. In a school, a teacher can teach more than one subject. • In the given table, non-prime attribute TEACHER_AGE is dependent on TEACHER_ID which is a proper subset of a candidate key. That's why it violates the rule for 2NF.
  • 26. 2NF
  • 27. Third Normal Form (3NF) • A relation will be in 3NF if it is in 2NF and not contain any transitive partial dependency. • 3NF is used to reduce the data duplication. It is also used to achieve the data integrity. • If there is no transitive dependency for non-prime attributes, then the relation must be in third normal form. • A relation is in third normal form if it holds atleast one of the following conditions for every non-trivial function dependency X → Y. • X is a super key. • Y is a prime attribute, i.e., each element of Y is part of some candidate key.
  • 28. 3NF
  • 29. 3NF • Super key in the table above: • {EMP_ID}, {EMP_ID, EMP_NAME}, {EMP_ID, EMP_NAME, EMP_ZIP}....so on • Candidate key: {EMP_ID} • Non-prime attributes: In the given table, all attributes except EMP_ID are non-prime. • Here, EMP_STATE & EMP_CITY dependent on EMP_ZIP and EMP_ZIP dependent on EMP_ID. The non-prime attributes (EMP_STATE, EMP_CITY) transitively dependent on super key(EMP_ID). It violates the rule of third normal form. • That's why we need to move the EMP_CITY and EMP_STATE to the new <EMPLOYEE_ZIP> table, with EMP_ZIP as a Primary key.