SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
How to create
                       E-R Diagrams from
                       Database Tables ?

                  Ecologic Corporation Training Department
                  Chandigarh
                  www.ecologic.co.in


                     Ecologic Corporation , Chandigarh ,
                             www.ecologic.co.in              1
26/04/2009
Learning Objectives
    Conversion of an ER model to relational
    schemas
         Entity sets, relationship sets, attributes,
         redundancy removal, specialization, and
         aggregation
    SQL constructs to create tables and
    constraints

                       Ecologic Corporation , Chandigarh
                                                           2
                         160022, www.ecologic.co.in
26/04/2009
Doing from E-R to Relational
    To create a relational database, we need a
    set of relational schemas.
    The first step of database design is to
    produce an E-R diagram that conforms to
    the user requirement.
    The subsequent step is to convert the E-R
    diagram into a collection of relational
    schemas, including constraints.
                 Ecologic Corporation , Chandigarh
                                                     3
                   160022, www.ecologic.co.in
26/04/2009
Step 1 :                           Conversion
    For each entity set, create a
    corresponding relational schema.
    For each relationship set, create a
    corresponding relational schema.
    Convert attributes in the E-R diagram to
    columns (attributes) in the relational
    schemas.

                  Ecologic Corporation , Chandigarh
                                                      4
                    160022, www.ecologic.co.in
26/04/2009
Entity Sets to Schemas
    A strong entity set is converted to a relation
    with no additional column.
    A weak entity set becomes a table that
    includes the primary key of the identifying
    strong entity set. E.g.,
       payment =
       ( loan_number, payment_number,
       payment_date, payment_amount )

                  Ecologic Corporation , Chandigarh
                                                      5
                    160022, www.ecologic.co.in
26/04/2009
Relationship Sets to Schemas
         A many-to-many relationship set is
         represented as a relation. Its
         attributes include the primary keys
         of the participating entity sets and
         the attributes of the relationship set.
             Example:
             borrower = (customer_id, loan_number )


                       Ecologic Corporation , Chandigarh
                                                           6
                         160022, www.ecologic.co.in
26/04/2009
Removing Redundancy:
Onemany-to-one or one-to-many relationshipto that is total on the
    to Many or Many set One
  A
         many-side can be represented by adding the attributes of the
         relationship set plus the primary key of the “one” side to the relation
         that correponds to the “many” side
         Example: Instead of creating a separate relation for the relationship
         set account_branch, we can just add an attribute branch_name to
         the relation that represents the entity set account.




                               Ecologic Corporation , Chandigarh
                                                                                   7
                                 160022, www.ecologic.co.in
26/04/2009
The next step:
Removing Redundancy :
One to One

 For a one-to-one relationship set, it can be
 represented by the relation that
 corresponds to the entity set on either side
 after adding the attributes from the
 relationship set and the primary key of the
 entity from the other side.

                Ecologic Corporation , Chandigarh
                                                    8
                  160022, www.ecologic.co.in
26/04/2009
Removing Redundancy :
Identifying Relationship
    The schema corresponding to the
    identifying relationship set linking a weak
    entity set to its identifying strong entity set
    is redundant.
         Example: The payment schema already
         contains the attributes that would appear in
         the loan_payment schema (i.e., loan_number
         and payment_number).

                      Ecologic Corporation , Chandigarh
                                                          9
                        160022, www.ecologic.co.in
26/04/2009
Composite Attributes
    Composite attributes are flattened out by
    creating a separate attribute for each
    component attribute
         Example: given entity set customer with
         composite attribute name with component
         attributes first_name and last_name, the
         schema corresponding to the entity set has
         two attributes
             name.first_name and name.last_name
                      Ecologic Corporation , Chandigarh
                                                          10
                        160022, www.ecologic.co.in
26/04/2009
Multivalued Attributes
        A multivalued attribute M of an entity E is represented by a
        separate schema EM
           Schema EM has attributes corresponding to the primary key
           of E and an attribute corresponding to the multivalued
           attribute M.
                E.g.,: dependent_names of employee is represented as
                employee_dependent_names = ( employee_id, dname)
           Each value of the multivalued attribute maps to a tuple of a
           relation on schema EM.
                E.g., an employee entity with primary key 123 and
                dependents Jack and Jane maps to two tuples: (123,
                Jack) and (123, Jane).


                           Ecologic Corporation , Chandigarh
                                                                          11
                             160022, www.ecologic.co.in
26/04/2009
Representing Specialization (1)

    Method 1:
         Form a schema for the higher-level entity set
         Form a schema for each lower-level entity
         set and include the primary key of the higher-
         level entity set and local attributes

              schema        attributes
             person     name, street, city
             customer name, credit_rating
             employee Ecologic Corporation , Chandigarh
                       name, salary                       12
                             160022, www.ecologic.co.in
26/04/2009
Representing Specialization (2)
         Method 2:
             Form a schema for each entity set with all
             local and inherited attributes

             schema     attributes
             person   name, street, city
             customer name, street, city, credit_rating
             employee name, street, city, salary



                       Ecologic Corporation , Chandigarh
                                                           13
                         160022, www.ecologic.co.in
26/04/2009
Comparison of the Two Methods of
Representing Specialization
    Method 1: getting information about an
    employee requires accessing two relations, the
    one corresponding to the low-level schema and
    the one corresponding to the high-level schema
    Method 2: If specialization is total, the schema
    for the generalized entity set (person) is not
    required to store information
         Drawback: street and city may be stored redundantly
         for people who are both customers and employees
                        Ecologic Corporation , Chandigarh
                                                            14
                          160022, www.ecologic.co.in
26/04/2009
Representing Aggregation
    Create a schema containing
         the primary key of the aggregated relationship
         the primary key of the associated entity set
         any attributes of the relationship




                      Ecologic Corporation , Chandigarh
                                                          15
                        160022, www.ecologic.co.in
26/04/2009
Example of Representing
   Aggregation




manages (employee_id, branch_name, title, manager_name)

                  Ecologic Corporation , Chandigarh
                                                      16
                    160022, www.ecologic.co.in
26/04/2009
History of SQL
    Developed as Sequel in System R project at
    the IBM San Jose Research Laboratory
    Renamed Structured Query Language (SQL)
    Became ANSI and ISO standards:
         SQL-86, SQL-89, SQL-92, SQL:1999, SQL:2003
    Most of SQL-92 features are offered by
    commercial systems, plus varying feature
    sets from later standards and special
    proprietary features.
                    Ecologic Corporation , Chandigarh
                                                        17
                      160022, www.ecologic.co.in
26/04/2009
Data Definition Language
    Defines
         The schema for each relation
         The domain of each attribute
         Integrity constraints
         Indexes for each relation
         Security and authorization information for
         each relation
         The physical storage structure of each
         relation on disk Corporation , Chandigarh
                       Ecologic
                                                      18
                        160022, www.ecologic.co.in
26/04/2009
Domain Types in SQL
    char(n), varchar(n) Fixed length or
    variable length character strings
    int, smallint Integers
    numeric(p,d) Fixed point number
    real, double precision, float(n) Floating
    point and double-precision floating point
    numbers
                  Ecologic Corporation , Chandigarh
                                                      19
                    160022, www.ecologic.co.in
26/04/2009
Create Table SQL Construct
    create table r (A1 D1, A2 D2, ..., An Dn,
                    (integrity-constraint1),
                    ...,
                    (integrity-constraintk))
         r is the name of the relation
         each Ai is an attribute name in the schema
         of relation r
         Di is the data type of values in the domain
         of attribute Ai
                      Ecologic Corporation , Chandigarh
                                                          20
                        160022, www.ecologic.co.in
26/04/2009
Example: Creating a Table
    create table branch
    (branch_name char(15) not null,
    branch_city    char(30),
    assets         integer)




                 Ecologic Corporation , Chandigarh
                                                     21
                   160022, www.ecologic.co.in
26/04/2009
Integrity Constraints in SQL
    not null
    primary key (A1, ..., An )
                 create table branch
                      (branch_name char(15),
                       branch_city      char(30),
                       assets    integer,
                       primary key (branch_name))
    primary key declaration on an attribute automatically ensures
       not null in SQL-92 onwards

                            Ecologic Corporation , Chandigarh
                                                                    22
                              160022, www.ecologic.co.in
26/04/2009
Drop and Alter Table Constructs
             The drop table command deletes all
             information about the dropped relation
             from the database.
             The alter table command can be used to
             add attributes to an existing relation:
                          alter table r add A D
              where A is the name of the attribute to be
             added to relation r and D is the domain
             of A.
                          Ecologic Corporation , Chandigarh
                                                              23
                            160022, www.ecologic.co.in
26/04/2009
Examples of ER Diagrams




                      Ecologic Corporation , Chandigarh
                                                          24
                        160022, www.ecologic.co.in
26/04/2009
Shopping Cart ER Diagram




                  Ecologic Corporation , Chandigarh
                                                      25
                    160022, www.ecologic.co.in
26/04/2009
North Wind DB ER Diagram




                  Ecologic Corporation , Chandigarh
                                                      26
                    160022, www.ecologic.co.in
26/04/2009
ER Diagrams Rules Simplified




                       Ecologic Corporation , Chandigarh
                                                           27
                         160022, www.ecologic.co.in
26/04/2009
Guess What this diagram is
Saying?




             Ecologic Corporation , Chandigarh
                                                 28
               160022, www.ecologic.co.in
26/04/2009
Summary
    In general, each entity set or relationship
    set is translated into a relation.
    There are special cases, including many-
    to-one, one-to-many, and one-to-one
    relationships; identifying relationships;
    multi-valued and composite attributes;
    specialization and aggregation.
    Tables and constraints are created,
    altered, and dropped through SQL DDL.
                  Ecologic Corporation , Chandigarh
                                                      29
                    160022, www.ecologic.co.in
26/04/2009

Contenu connexe

Tendances

Database Normalization
Database NormalizationDatabase Normalization
Database NormalizationArun Sharma
 
Importance of data model
Importance of data modelImportance of data model
Importance of data modelyhen06
 
Enhance ERD(Entity Relationship Diagram)
Enhance ERD(Entity Relationship Diagram)Enhance ERD(Entity Relationship Diagram)
Enhance ERD(Entity Relationship Diagram)Imdad Ul Haq
 
Visibility control in java
Visibility control in javaVisibility control in java
Visibility control in javaTech_MX
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mappingShubham Saini
 
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...Beat Signer
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramSiti Ismail
 
Data mining: Classification and prediction
Data mining: Classification and predictionData mining: Classification and prediction
Data mining: Classification and predictionDataminingTools Inc
 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNANDINI SHARMA
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbmsVignesh Saravanan
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data miningKamal Acharya
 
Chapter-2 Database System Concepts and Architecture
Chapter-2 Database System Concepts and ArchitectureChapter-2 Database System Concepts and Architecture
Chapter-2 Database System Concepts and ArchitectureKunal Anand
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mappingsaurabhshertukde
 
Implementation Issue with ORDBMS
Implementation Issue with ORDBMSImplementation Issue with ORDBMS
Implementation Issue with ORDBMSSandeep Poudel
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER ModelMary Brinda
 
3 data modeling using the entity-relationship (er) model
3 data modeling using the entity-relationship (er) model3 data modeling using the entity-relationship (er) model
3 data modeling using the entity-relationship (er) modelKumar
 

Tendances (20)

Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Importance of data model
Importance of data modelImportance of data model
Importance of data model
 
Enhance ERD(Entity Relationship Diagram)
Enhance ERD(Entity Relationship Diagram)Enhance ERD(Entity Relationship Diagram)
Enhance ERD(Entity Relationship Diagram)
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
 
Visibility control in java
Visibility control in javaVisibility control in java
Visibility control in java
 
Er diagrams presentation
Er diagrams presentationEr diagrams presentation
Er diagrams presentation
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mapping
 
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Data mining: Classification and prediction
Data mining: Classification and predictionData mining: Classification and prediction
Data mining: Classification and prediction
 
DBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.pptDBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.ppt
 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphics
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data mining
 
Chapter-2 Database System Concepts and Architecture
Chapter-2 Database System Concepts and ArchitectureChapter-2 Database System Concepts and Architecture
Chapter-2 Database System Concepts and Architecture
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mapping
 
Implementation Issue with ORDBMS
Implementation Issue with ORDBMSImplementation Issue with ORDBMS
Implementation Issue with ORDBMS
 
Object oriented database
Object oriented databaseObject oriented database
Object oriented database
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER Model
 
3 data modeling using the entity-relationship (er) model
3 data modeling using the entity-relationship (er) model3 data modeling using the entity-relationship (er) model
3 data modeling using the entity-relationship (er) model
 

En vedette

How to Draw an Effective ER diagram
How to Draw an Effective ER diagramHow to Draw an Effective ER diagram
How to Draw an Effective ER diagramTech_MX
 
Semi Formal Model for Document Oriented Databases
Semi Formal Model for Document Oriented DatabasesSemi Formal Model for Document Oriented Databases
Semi Formal Model for Document Oriented DatabasesDaniel Coupal
 
Er diagram practical examples
Er diagram practical examplesEr diagram practical examples
Er diagram practical examplesRahul Khanwani
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)tameemyousaf
 
Introduction to database design with Idef1X entity relationship (ER) diagrams
Introduction to database design with Idef1X entity relationship (ER) diagramsIntroduction to database design with Idef1X entity relationship (ER) diagrams
Introduction to database design with Idef1X entity relationship (ER) diagramsMark A
 
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ARADHYAYANA
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3) Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3) Aey Unthika
 
Entity Relationship Diagram presentation
Entity Relationship Diagram presentationEntity Relationship Diagram presentation
Entity Relationship Diagram presentationSopov Chan
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Mudasir Qazi
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
Design Process Overview
Design Process OverviewDesign Process Overview
Design Process OverviewMr. Klonowski
 
Biconnected components (13024116056)
Biconnected components (13024116056)Biconnected components (13024116056)
Biconnected components (13024116056)Akshay soni
 
Microsoft SQL Server Seven Deadly Sins of Database Design
Microsoft SQL Server Seven Deadly Sins of Database DesignMicrosoft SQL Server Seven Deadly Sins of Database Design
Microsoft SQL Server Seven Deadly Sins of Database DesignMark Ginnebaugh
 

En vedette (20)

How to Draw an Effective ER diagram
How to Draw an Effective ER diagramHow to Draw an Effective ER diagram
How to Draw an Effective ER diagram
 
Semi Formal Model for Document Oriented Databases
Semi Formal Model for Document Oriented DatabasesSemi Formal Model for Document Oriented Databases
Semi Formal Model for Document Oriented Databases
 
Er diagram practical examples
Er diagram practical examplesEr diagram practical examples
Er diagram practical examples
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 
Introduction to database design with Idef1X entity relationship (ER) diagrams
Introduction to database design with Idef1X entity relationship (ER) diagramsIntroduction to database design with Idef1X entity relationship (ER) diagrams
Introduction to database design with Idef1X entity relationship (ER) diagrams
 
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
 
Erd practice exercises
Erd practice exercisesErd practice exercises
Erd practice exercises
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Er model
Er modelEr model
Er model
 
Chapter2
Chapter2Chapter2
Chapter2
 
Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3) Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3)
 
Crj 3 1-b
Crj 3 1-bCrj 3 1-b
Crj 3 1-b
 
Entity Relationship Diagram presentation
Entity Relationship Diagram presentationEntity Relationship Diagram presentation
Entity Relationship Diagram presentation
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Erd examples
Erd examplesErd examples
Erd examples
 
Design Process Overview
Design Process OverviewDesign Process Overview
Design Process Overview
 
ER/Studio Data Architect Datasheet
ER/Studio Data Architect DatasheetER/Studio Data Architect Datasheet
ER/Studio Data Architect Datasheet
 
Biconnected components (13024116056)
Biconnected components (13024116056)Biconnected components (13024116056)
Biconnected components (13024116056)
 
Microsoft SQL Server Seven Deadly Sins of Database Design
Microsoft SQL Server Seven Deadly Sins of Database DesignMicrosoft SQL Server Seven Deadly Sins of Database Design
Microsoft SQL Server Seven Deadly Sins of Database Design
 

Similaire à ER Diagrams Simplified

IRJET- Automatic Database Schema Generator
IRJET- Automatic Database Schema GeneratorIRJET- Automatic Database Schema Generator
IRJET- Automatic Database Schema GeneratorIRJET Journal
 
Automating and Validating Semantic Annotations.pdf
Automating and Validating Semantic Annotations.pdfAutomating and Validating Semantic Annotations.pdf
Automating and Validating Semantic Annotations.pdfKathryn Patel
 
A WEB BASED APPLICATION FOR RESUME PARSER USING NATURAL LANGUAGE PROCESSING T...
A WEB BASED APPLICATION FOR RESUME PARSER USING NATURAL LANGUAGE PROCESSING T...A WEB BASED APPLICATION FOR RESUME PARSER USING NATURAL LANGUAGE PROCESSING T...
A WEB BASED APPLICATION FOR RESUME PARSER USING NATURAL LANGUAGE PROCESSING T...IRJET Journal
 
OMD chapter 2 Class modelling
 OMD  chapter 2 Class modelling OMD  chapter 2 Class modelling
OMD chapter 2 Class modellingjayashri kolekar
 
Object Oriented Database
Object Oriented DatabaseObject Oriented Database
Object Oriented DatabaseMegan Espinoza
 
Possible Algorithms of 2NF and 3NF for DBNorma- A tool for Relational Databas...
Possible Algorithms of 2NF and 3NF for DBNorma- A tool for Relational Databas...Possible Algorithms of 2NF and 3NF for DBNorma- A tool for Relational Databas...
Possible Algorithms of 2NF and 3NF for DBNorma- A tool for Relational Databas...IDES Editor
 
TECHNIQUES FOR COMPONENT REUSABLE APPROACH
TECHNIQUES FOR COMPONENT REUSABLE APPROACHTECHNIQUES FOR COMPONENT REUSABLE APPROACH
TECHNIQUES FOR COMPONENT REUSABLE APPROACHcscpconf
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)ijceronline
 
Overview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaOverview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaJignesh Aakoliya
 
Relational Database & Database Management System
Relational Database & Database Management SystemRelational Database & Database Management System
Relational Database & Database Management SystemNimrakhan89
 
A Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationA Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationCoen De Roover
 
Semi Automatic to Improve Ontology Mapping Process in Semantic Web Data Analysis
Semi Automatic to Improve Ontology Mapping Process in Semantic Web Data AnalysisSemi Automatic to Improve Ontology Mapping Process in Semantic Web Data Analysis
Semi Automatic to Improve Ontology Mapping Process in Semantic Web Data AnalysisIRJET Journal
 
FEATURE LEVEL FUSION USING FACE AND PALMPRINT BIOMETRICS FOR SECURED AUTHENTI...
FEATURE LEVEL FUSION USING FACE AND PALMPRINT BIOMETRICS FOR SECURED AUTHENTI...FEATURE LEVEL FUSION USING FACE AND PALMPRINT BIOMETRICS FOR SECURED AUTHENTI...
FEATURE LEVEL FUSION USING FACE AND PALMPRINT BIOMETRICS FOR SECURED AUTHENTI...pharmaindexing
 

Similaire à ER Diagrams Simplified (20)

IRJET- Automatic Database Schema Generator
IRJET- Automatic Database Schema GeneratorIRJET- Automatic Database Schema Generator
IRJET- Automatic Database Schema Generator
 
Automating and Validating Semantic Annotations.pdf
Automating and Validating Semantic Annotations.pdfAutomating and Validating Semantic Annotations.pdf
Automating and Validating Semantic Annotations.pdf
 
A WEB BASED APPLICATION FOR RESUME PARSER USING NATURAL LANGUAGE PROCESSING T...
A WEB BASED APPLICATION FOR RESUME PARSER USING NATURAL LANGUAGE PROCESSING T...A WEB BASED APPLICATION FOR RESUME PARSER USING NATURAL LANGUAGE PROCESSING T...
A WEB BASED APPLICATION FOR RESUME PARSER USING NATURAL LANGUAGE PROCESSING T...
 
SE.pptx
SE.pptxSE.pptx
SE.pptx
 
OMD chapter 2 Class modelling
 OMD  chapter 2 Class modelling OMD  chapter 2 Class modelling
OMD chapter 2 Class modelling
 
Object Oriented Database
Object Oriented DatabaseObject Oriented Database
Object Oriented Database
 
Possible Algorithms of 2NF and 3NF for DBNorma- A tool for Relational Databas...
Possible Algorithms of 2NF and 3NF for DBNorma- A tool for Relational Databas...Possible Algorithms of 2NF and 3NF for DBNorma- A tool for Relational Databas...
Possible Algorithms of 2NF and 3NF for DBNorma- A tool for Relational Databas...
 
[0201699613]visual modeling with rational rose 2000 and uml
[0201699613]visual modeling with rational rose 2000 and uml[0201699613]visual modeling with rational rose 2000 and uml
[0201699613]visual modeling with rational rose 2000 and uml
 
G U I Stud
G U I StudG U I Stud
G U I Stud
 
Gui stud
Gui studGui stud
Gui stud
 
TECHNIQUES FOR COMPONENT REUSABLE APPROACH
TECHNIQUES FOR COMPONENT REUSABLE APPROACHTECHNIQUES FOR COMPONENT REUSABLE APPROACH
TECHNIQUES FOR COMPONENT REUSABLE APPROACH
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Sq lite module4
Sq lite module4Sq lite module4
Sq lite module4
 
Overview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaOverview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company india
 
Relational Database & Database Management System
Relational Database & Database Management SystemRelational Database & Database Management System
Relational Database & Database Management System
 
L7 er2
L7 er2L7 er2
L7 er2
 
A Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationA Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X Transformation
 
Semi Automatic to Improve Ontology Mapping Process in Semantic Web Data Analysis
Semi Automatic to Improve Ontology Mapping Process in Semantic Web Data AnalysisSemi Automatic to Improve Ontology Mapping Process in Semantic Web Data Analysis
Semi Automatic to Improve Ontology Mapping Process in Semantic Web Data Analysis
 
FEATURE LEVEL FUSION USING FACE AND PALMPRINT BIOMETRICS FOR SECURED AUTHENTI...
FEATURE LEVEL FUSION USING FACE AND PALMPRINT BIOMETRICS FOR SECURED AUTHENTI...FEATURE LEVEL FUSION USING FACE AND PALMPRINT BIOMETRICS FOR SECURED AUTHENTI...
FEATURE LEVEL FUSION USING FACE AND PALMPRINT BIOMETRICS FOR SECURED AUTHENTI...
 
Ch02 3133
Ch02 3133Ch02 3133
Ch02 3133
 

Plus de Puneet Arora

A beginners guide to YouTube Channel Set & Marketing
A beginners guide to YouTube Channel Set & Marketing A beginners guide to YouTube Channel Set & Marketing
A beginners guide to YouTube Channel Set & Marketing Puneet Arora
 
Data-Visualization for Better Presentations
Data-Visualization for Better Presentations Data-Visualization for Better Presentations
Data-Visualization for Better Presentations Puneet Arora
 
Primer On Man-Machine Reconciliation In Context of AI
Primer On Man-Machine Reconciliation In Context of AIPrimer On Man-Machine Reconciliation In Context of AI
Primer On Man-Machine Reconciliation In Context of AIPuneet Arora
 
Primer on Supervised Learning and Unsupervised Learning Modelling for Non-Tec...
Primer on Supervised Learning and Unsupervised Learning Modelling for Non-Tec...Primer on Supervised Learning and Unsupervised Learning Modelling for Non-Tec...
Primer on Supervised Learning and Unsupervised Learning Modelling for Non-Tec...Puneet Arora
 
Primer on Machine Learning for Non-Technical
Primer on Machine Learning for Non-Technical Primer on Machine Learning for Non-Technical
Primer on Machine Learning for Non-Technical Puneet Arora
 
Primer On Data Visualization For Growth Minded People
Primer On Data Visualization For Growth  Minded People Primer On Data Visualization For Growth  Minded People
Primer On Data Visualization For Growth Minded People Puneet Arora
 
Primer on Data Characteristics for Machine Learning For Non-Technicals
Primer on Data Characteristics for Machine Learning For Non-TechnicalsPrimer on Data Characteristics for Machine Learning For Non-Technicals
Primer on Data Characteristics for Machine Learning For Non-TechnicalsPuneet Arora
 
Gig Based Career Options in Pandemic
Gig Based Career Options in Pandemic  Gig Based Career Options in Pandemic
Gig Based Career Options in Pandemic Puneet Arora
 
Talk on kitchen gardening
Talk on kitchen gardeningTalk on kitchen gardening
Talk on kitchen gardeningPuneet Arora
 
Security threats in cloud computing
Security threats  in cloud computingSecurity threats  in cloud computing
Security threats in cloud computingPuneet Arora
 
Optimization of Cognitive Radio
Optimization of Cognitive Radio Optimization of Cognitive Radio
Optimization of Cognitive Radio Puneet Arora
 
Career Orientation
Career OrientationCareer Orientation
Career OrientationPuneet Arora
 
How to create Orkut kind of Website in ASP.NET
How to create Orkut kind of Website in ASP.NETHow to create Orkut kind of Website in ASP.NET
How to create Orkut kind of Website in ASP.NETPuneet Arora
 
X 509 Certificates How And Why In Vb.Net
X 509 Certificates How And Why In Vb.NetX 509 Certificates How And Why In Vb.Net
X 509 Certificates How And Why In Vb.NetPuneet Arora
 

Plus de Puneet Arora (15)

A beginners guide to YouTube Channel Set & Marketing
A beginners guide to YouTube Channel Set & Marketing A beginners guide to YouTube Channel Set & Marketing
A beginners guide to YouTube Channel Set & Marketing
 
Data-Visualization for Better Presentations
Data-Visualization for Better Presentations Data-Visualization for Better Presentations
Data-Visualization for Better Presentations
 
Primer On Man-Machine Reconciliation In Context of AI
Primer On Man-Machine Reconciliation In Context of AIPrimer On Man-Machine Reconciliation In Context of AI
Primer On Man-Machine Reconciliation In Context of AI
 
Primer on Supervised Learning and Unsupervised Learning Modelling for Non-Tec...
Primer on Supervised Learning and Unsupervised Learning Modelling for Non-Tec...Primer on Supervised Learning and Unsupervised Learning Modelling for Non-Tec...
Primer on Supervised Learning and Unsupervised Learning Modelling for Non-Tec...
 
Primer on Machine Learning for Non-Technical
Primer on Machine Learning for Non-Technical Primer on Machine Learning for Non-Technical
Primer on Machine Learning for Non-Technical
 
Primer On Data Visualization For Growth Minded People
Primer On Data Visualization For Growth  Minded People Primer On Data Visualization For Growth  Minded People
Primer On Data Visualization For Growth Minded People
 
Primer on Data Characteristics for Machine Learning For Non-Technicals
Primer on Data Characteristics for Machine Learning For Non-TechnicalsPrimer on Data Characteristics for Machine Learning For Non-Technicals
Primer on Data Characteristics for Machine Learning For Non-Technicals
 
Gig Based Career Options in Pandemic
Gig Based Career Options in Pandemic  Gig Based Career Options in Pandemic
Gig Based Career Options in Pandemic
 
Talk on kitchen gardening
Talk on kitchen gardeningTalk on kitchen gardening
Talk on kitchen gardening
 
Security threats in cloud computing
Security threats  in cloud computingSecurity threats  in cloud computing
Security threats in cloud computing
 
Optimization of Cognitive Radio
Optimization of Cognitive Radio Optimization of Cognitive Radio
Optimization of Cognitive Radio
 
Career Orientation
Career OrientationCareer Orientation
Career Orientation
 
How to create Orkut kind of Website in ASP.NET
How to create Orkut kind of Website in ASP.NETHow to create Orkut kind of Website in ASP.NET
How to create Orkut kind of Website in ASP.NET
 
X 509 Certificates How And Why In Vb.Net
X 509 Certificates How And Why In Vb.NetX 509 Certificates How And Why In Vb.Net
X 509 Certificates How And Why In Vb.Net
 
Data Flow Diagram
Data Flow DiagramData Flow Diagram
Data Flow Diagram
 

Dernier

(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)oannq
 
Module-2-Lesson-2-COMMUNICATION-AIDS-AND-STRATEGIES-USING-TOOLS-OF-TECHNOLOGY...
Module-2-Lesson-2-COMMUNICATION-AIDS-AND-STRATEGIES-USING-TOOLS-OF-TECHNOLOGY...Module-2-Lesson-2-COMMUNICATION-AIDS-AND-STRATEGIES-USING-TOOLS-OF-TECHNOLOGY...
Module-2-Lesson-2-COMMUNICATION-AIDS-AND-STRATEGIES-USING-TOOLS-OF-TECHNOLOGY...JeylaisaManabat1
 
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...Authentic No 1 Amil Baba In Pakistan
 
Inspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptxInspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptxShubham Rawat
 
南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证kbdhl05e
 
E J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptxE J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptxJackieSparrow3
 

Dernier (6)

(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)
 
Module-2-Lesson-2-COMMUNICATION-AIDS-AND-STRATEGIES-USING-TOOLS-OF-TECHNOLOGY...
Module-2-Lesson-2-COMMUNICATION-AIDS-AND-STRATEGIES-USING-TOOLS-OF-TECHNOLOGY...Module-2-Lesson-2-COMMUNICATION-AIDS-AND-STRATEGIES-USING-TOOLS-OF-TECHNOLOGY...
Module-2-Lesson-2-COMMUNICATION-AIDS-AND-STRATEGIES-USING-TOOLS-OF-TECHNOLOGY...
 
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
 
Inspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptxInspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptx
 
南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证
 
E J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptxE J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptx
 

ER Diagrams Simplified

  • 1. How to create E-R Diagrams from Database Tables ? Ecologic Corporation Training Department Chandigarh www.ecologic.co.in Ecologic Corporation , Chandigarh , www.ecologic.co.in 1 26/04/2009
  • 2. Learning Objectives Conversion of an ER model to relational schemas Entity sets, relationship sets, attributes, redundancy removal, specialization, and aggregation SQL constructs to create tables and constraints Ecologic Corporation , Chandigarh 2 160022, www.ecologic.co.in 26/04/2009
  • 3. Doing from E-R to Relational To create a relational database, we need a set of relational schemas. The first step of database design is to produce an E-R diagram that conforms to the user requirement. The subsequent step is to convert the E-R diagram into a collection of relational schemas, including constraints. Ecologic Corporation , Chandigarh 3 160022, www.ecologic.co.in 26/04/2009
  • 4. Step 1 : Conversion For each entity set, create a corresponding relational schema. For each relationship set, create a corresponding relational schema. Convert attributes in the E-R diagram to columns (attributes) in the relational schemas. Ecologic Corporation , Chandigarh 4 160022, www.ecologic.co.in 26/04/2009
  • 5. Entity Sets to Schemas A strong entity set is converted to a relation with no additional column. A weak entity set becomes a table that includes the primary key of the identifying strong entity set. E.g., payment = ( loan_number, payment_number, payment_date, payment_amount ) Ecologic Corporation , Chandigarh 5 160022, www.ecologic.co.in 26/04/2009
  • 6. Relationship Sets to Schemas A many-to-many relationship set is represented as a relation. Its attributes include the primary keys of the participating entity sets and the attributes of the relationship set. Example: borrower = (customer_id, loan_number ) Ecologic Corporation , Chandigarh 6 160022, www.ecologic.co.in 26/04/2009
  • 7. Removing Redundancy: Onemany-to-one or one-to-many relationshipto that is total on the to Many or Many set One A many-side can be represented by adding the attributes of the relationship set plus the primary key of the “one” side to the relation that correponds to the “many” side Example: Instead of creating a separate relation for the relationship set account_branch, we can just add an attribute branch_name to the relation that represents the entity set account. Ecologic Corporation , Chandigarh 7 160022, www.ecologic.co.in 26/04/2009
  • 8. The next step: Removing Redundancy : One to One For a one-to-one relationship set, it can be represented by the relation that corresponds to the entity set on either side after adding the attributes from the relationship set and the primary key of the entity from the other side. Ecologic Corporation , Chandigarh 8 160022, www.ecologic.co.in 26/04/2009
  • 9. Removing Redundancy : Identifying Relationship The schema corresponding to the identifying relationship set linking a weak entity set to its identifying strong entity set is redundant. Example: The payment schema already contains the attributes that would appear in the loan_payment schema (i.e., loan_number and payment_number). Ecologic Corporation , Chandigarh 9 160022, www.ecologic.co.in 26/04/2009
  • 10. Composite Attributes Composite attributes are flattened out by creating a separate attribute for each component attribute Example: given entity set customer with composite attribute name with component attributes first_name and last_name, the schema corresponding to the entity set has two attributes name.first_name and name.last_name Ecologic Corporation , Chandigarh 10 160022, www.ecologic.co.in 26/04/2009
  • 11. Multivalued Attributes A multivalued attribute M of an entity E is represented by a separate schema EM Schema EM has attributes corresponding to the primary key of E and an attribute corresponding to the multivalued attribute M. E.g.,: dependent_names of employee is represented as employee_dependent_names = ( employee_id, dname) Each value of the multivalued attribute maps to a tuple of a relation on schema EM. E.g., an employee entity with primary key 123 and dependents Jack and Jane maps to two tuples: (123, Jack) and (123, Jane). Ecologic Corporation , Chandigarh 11 160022, www.ecologic.co.in 26/04/2009
  • 12. Representing Specialization (1) Method 1: Form a schema for the higher-level entity set Form a schema for each lower-level entity set and include the primary key of the higher- level entity set and local attributes schema attributes person name, street, city customer name, credit_rating employee Ecologic Corporation , Chandigarh name, salary 12 160022, www.ecologic.co.in 26/04/2009
  • 13. Representing Specialization (2) Method 2: Form a schema for each entity set with all local and inherited attributes schema attributes person name, street, city customer name, street, city, credit_rating employee name, street, city, salary Ecologic Corporation , Chandigarh 13 160022, www.ecologic.co.in 26/04/2009
  • 14. Comparison of the Two Methods of Representing Specialization Method 1: getting information about an employee requires accessing two relations, the one corresponding to the low-level schema and the one corresponding to the high-level schema Method 2: If specialization is total, the schema for the generalized entity set (person) is not required to store information Drawback: street and city may be stored redundantly for people who are both customers and employees Ecologic Corporation , Chandigarh 14 160022, www.ecologic.co.in 26/04/2009
  • 15. Representing Aggregation Create a schema containing the primary key of the aggregated relationship the primary key of the associated entity set any attributes of the relationship Ecologic Corporation , Chandigarh 15 160022, www.ecologic.co.in 26/04/2009
  • 16. Example of Representing Aggregation manages (employee_id, branch_name, title, manager_name) Ecologic Corporation , Chandigarh 16 160022, www.ecologic.co.in 26/04/2009
  • 17. History of SQL Developed as Sequel in System R project at the IBM San Jose Research Laboratory Renamed Structured Query Language (SQL) Became ANSI and ISO standards: SQL-86, SQL-89, SQL-92, SQL:1999, SQL:2003 Most of SQL-92 features are offered by commercial systems, plus varying feature sets from later standards and special proprietary features. Ecologic Corporation , Chandigarh 17 160022, www.ecologic.co.in 26/04/2009
  • 18. Data Definition Language Defines The schema for each relation The domain of each attribute Integrity constraints Indexes for each relation Security and authorization information for each relation The physical storage structure of each relation on disk Corporation , Chandigarh Ecologic 18 160022, www.ecologic.co.in 26/04/2009
  • 19. Domain Types in SQL char(n), varchar(n) Fixed length or variable length character strings int, smallint Integers numeric(p,d) Fixed point number real, double precision, float(n) Floating point and double-precision floating point numbers Ecologic Corporation , Chandigarh 19 160022, www.ecologic.co.in 26/04/2009
  • 20. Create Table SQL Construct create table r (A1 D1, A2 D2, ..., An Dn, (integrity-constraint1), ..., (integrity-constraintk)) r is the name of the relation each Ai is an attribute name in the schema of relation r Di is the data type of values in the domain of attribute Ai Ecologic Corporation , Chandigarh 20 160022, www.ecologic.co.in 26/04/2009
  • 21. Example: Creating a Table create table branch (branch_name char(15) not null, branch_city char(30), assets integer) Ecologic Corporation , Chandigarh 21 160022, www.ecologic.co.in 26/04/2009
  • 22. Integrity Constraints in SQL not null primary key (A1, ..., An ) create table branch (branch_name char(15), branch_city char(30), assets integer, primary key (branch_name)) primary key declaration on an attribute automatically ensures not null in SQL-92 onwards Ecologic Corporation , Chandigarh 22 160022, www.ecologic.co.in 26/04/2009
  • 23. Drop and Alter Table Constructs The drop table command deletes all information about the dropped relation from the database. The alter table command can be used to add attributes to an existing relation: alter table r add A D where A is the name of the attribute to be added to relation r and D is the domain of A. Ecologic Corporation , Chandigarh 23 160022, www.ecologic.co.in 26/04/2009
  • 24. Examples of ER Diagrams Ecologic Corporation , Chandigarh 24 160022, www.ecologic.co.in 26/04/2009
  • 25. Shopping Cart ER Diagram Ecologic Corporation , Chandigarh 25 160022, www.ecologic.co.in 26/04/2009
  • 26. North Wind DB ER Diagram Ecologic Corporation , Chandigarh 26 160022, www.ecologic.co.in 26/04/2009
  • 27. ER Diagrams Rules Simplified Ecologic Corporation , Chandigarh 27 160022, www.ecologic.co.in 26/04/2009
  • 28. Guess What this diagram is Saying? Ecologic Corporation , Chandigarh 28 160022, www.ecologic.co.in 26/04/2009
  • 29. Summary In general, each entity set or relationship set is translated into a relation. There are special cases, including many- to-one, one-to-many, and one-to-one relationships; identifying relationships; multi-valued and composite attributes; specialization and aggregation. Tables and constraints are created, altered, and dropped through SQL DDL. Ecologic Corporation , Chandigarh 29 160022, www.ecologic.co.in 26/04/2009