SlideShare a Scribd company logo
Relational Model
Asst.Prof. Rupali Lohar
Dept. of Computer Science & Engineering
B. R. Harne College Of Engineering & Technology, Karav, Post Vangani (W Tal
Ambernath, Mumbai, Maharashtra 421503
S# SNAME STATUS CITY
S1 Smith 20 London
S2 Jones 10 Paris
S3 Blake 30 Paris
S4 Clark 20 London
S5 Adams 30 Athens
2
 Relational Databases
 represent data as a collection of tables
 each row in a table represents a collection of related values
Example
Supplier S
Relational Model –
3
 Tables (relations)
 Rows (tuples)
 Columns (attributes)
 tuples
 No duplicate tuples
 Domains
Relational Data Structure
4
 Table is the Data Structure for relational model
 Relation = Table
 name of this relation is S.
 Tuple = Row
 This relation has 5 tuples
 Each tuple represents a record of one supplier, so tuples
are seldom called records also.
S# SNAME STATUS CITY
S1 Smith 20 London
S2 Jones 10 Paris
S3 Blake 30 Paris
S4 Clark 20 London
S5 Adams 30 Athens
Supplier S
Relational Data Structure
5
 Cardinality = # of rows with data in the relation
 so for S, cardinality = 5.
 Attribute = Columns or fields.
 Degree = # of columns or fields of a relation.
 The relation S has a degree of 4.
S# SNAME STATUS CITY
S1 Smith 20 London
S2 Jones 10 Paris
S3 Blake 30 Paris
S4 Clark 20 London
S5 Adams 30 Athens
Supplier S
Relational Data Structure
6
 Domain = A pool of legal values
 For example:
 For S# we have S followed by a positive number.
 For Year we might have a four digit positive number between
1000 and 2003.
 Primary Key = A unique identifier, used to identify one
specific record from among all other records.
S# SNAME STATUS CITY
S1 Smith 20 London
S2 Jones 10 Paris
S3 Blake 30 Paris
S4 Clark 20 London
S5 Adams 30 Athens
Supplier S
Relations
7
 A relation consists of 2 parts
 Heading:
 Consists of a fixed set of attributes or columns or fields.
 Body
 Consists of the tuples or rows or records.
 Time varying set, i.e., at different intervals of time
there may be different contents in the body of a
relation.
Key Properties of Relations
8
 No Duplicate tuples
 In other words, not all fields are same
 All cells have a single value
 A relation which follows this rule is said to be in the
first normal form.
Structure of Relational Database
• Basic Structure
– The relational model uses a collection of tables.
– These tables have multiple columns, and each column has a unique name called attributes.
– The set of allowed values for each attribute is called the domain of the attribute
– whether the tuples of a relation are listed in sorted order, as in Figure 1, or are unsorted,
as in Figure 2, does not matter
The account relation.
9
The account relation with unordered tuples.
Structure of Relational Database
• Database Schema
The customer relation The branch relation.. The account relation. The depositor relation.
The loan relation.
10
The borrower relation.
• Database Schema
11
12
Structure of Relational Database
• Schema Diagram
– A database schema, along with primary key and foreign key dependencies, can be
depicted pictorially by schema diagrams.
• Each relation appears as a box, with the attributes listed inside it and the relation name above
it.
• If there are primary key attributes, a horizontal line crosses the box, with the primary key
attributes listed above the line.
• Foreign key dependencies appear as arrows from the foreign key attributes of the referencing
relation to the primary key of the referenced relation.
• Schema Diagram
– Figure shows the schema diagram for our banking enterprise.
13
ER Model to Relational Model
• ER diagrams can be mapped to relational schema, that is, it is
possible to create relational schema using ER diagram. We cannot
import all the ER constraints into relational model, but an
approximate schema can be generated.
Mapping Entity
Mapping Process (Algorithm)
• Create table for each entity.
• Entity's attributes should become fields of tables with their respective
data types.
• Declare primary key.
Mapping Relationship
Mapping Process
• Create table for a relationship.
• Add the primary keys of all participating Entities as fields of table with
their respective data types.
• If relationship has any attribute, add each attribute as field of table.
• Declare a primary key composing all the primary keys of participating
entities.
• Declare all foreign key constraints.
Mapping Weak Entity Sets
Mapping Process
• Create table for weak entity set.
• Add all its attributes to table as field.
• Add the primary key of identifying entity set.
• Declare all foreign key constraints.
Mapping Hierarchical Entities
ER specialization or generalization comes in the form of hierarchical entity
sets.
Mapping Process
• Create tables for all higher-level entities.
• Create tables for lower-level entities.
• Add primary keys of higher-level entities in the table of lower-level entities.
• In lower-level tables, add all other attributes of lower-level entities.
• Declare primary key of higher-level table and the primary key for lower-
level table.
• Declare foreign key constraints.
E-R Diagram for Banking Example
depositorcustomer
customer_name customer_city
customer_street
account_number
account
branch_name
balance
loan
branch_name
loan_number amount
borrower
branch_name
branch
branch_city
assets
account_
brach
loan_
branch
1
9
Reduction of an E-R Diagram to Relational
Schemas
• Representation of Strong Entity Sets
 Example
customer
customer_name customer_city
customer_street
customer_name customer_street customer_city
2
0
The relation customer
Reduction of an E-R Diagram to Relational
Schemas
loan_pay
ment
loan payment
• Representation of Weak Entity Sets
 Example
branch_name payment_date
loan_number amount payment_number payment_amount
loan_number payment_number payment_date payment_amount
2
1
The relation payment
Reduction of an E-R Diagram to Relational
Schemas
customer depositor account
• Tabular Representation of Relationship Sets
 Example
access_date
customer_street branch_name
customer_name customer_city account_number balance
customer_name account_number access_date
8TMhrse.SrueniltaaMtioDonl,WdeIT,pSoolaspiutror
Reduction of an E-R Diagram to Relational
Schemas
• Tabular Representation of Relationship Sets
 Combination of Tables
Example : we can combine the table for
account-branch with the table for account and
require only the following two tables:
account, with attributes account-number,
balance, and branch-name
branch, with attributes branch-name,
branch-city, and assets
account_number
account
branch_name
branch_name
branch
branch_city
assets
account_
brach
balance
14Mrs. Sunita M Dol, WIT,Solapur
Reduction of an E-R Diagram to Relational
Schemas
• Composite Attributes
 We handle composite attributes by creating a separate attribute for each of
the component attributes; we do not create a separate column for the
composite attribute itself.
 Suppose address is a composite attribute of entity set customer, and the
components of address are street and city. The table generated from
customer would then contain columns address-street and address-city;
there is no separate column for address
15Mrs. Sunita M Dol, WIT,Solapur
Reduction of an E-R Diagram to Relational
Schemas
• Composite Attributes
 Example
customer_name
customer
address
phone_number
Street city
customer_name customer_street customer_city phone_number
16TMhrse.SrueniltaaMtioDonl,WcuIT,sStoolampurer
Reduction of an E-R Diagram to Relational
Schemas
• Multivalued Attributes
 For a multivalued attribute M, we create a table T with a column C that
corresponds to M and columns corresponding to the primary key of the entity
set or relationship set of which M is an attribute.
17
Reduction of an E-R Diagram to Relational
Schemas• MultivaluedAttributes
 Example: For the multivalued attribute dependent-name, we create a table
dependent-name, with columns dname, referring to the dependent-name
attribute of employee, and employee-id, representing the primary key of the
entity set employee. Each dependent of an employee is represented as a
unique row in the table.
dname employee_id
The relation dependent_name 18
Advantages of Relational Model
• Simple
• Scalable
• Structural Independence
Disadvantages of Relational Model
• Hardware Overheads: more powerful hardware computers and data
storage devices.
• Bad Design: As the relational model is very easy to design and use. So
the users don't need to know how the data is stored in order to
access it.

More Related Content

What's hot

Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra Operations
A. S. M. Shafi
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebraguest20b0b3
 
Relational Algebra Introduction
Relational Algebra IntroductionRelational Algebra Introduction
Relational Algebra Introduction
Md. Afif Al Mamun
 
Chapter-7 Relational Calculus
Chapter-7 Relational CalculusChapter-7 Relational Calculus
Chapter-7 Relational Calculus
Kunal Anand
 
Relational model
Relational modelRelational model
Relational model
RUpaliLohar
 
Understanding databases and querying
Understanding databases and queryingUnderstanding databases and querying
Understanding databases and queryingUsman Sharif
 
Intro to relational model
Intro to relational modelIntro to relational model
Intro to relational model
ATS SBGI MIRAJ
 
5 the relational algebra and calculus
5 the relational algebra and calculus5 the relational algebra and calculus
5 the relational algebra and calculusKumar
 
Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...
Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...
Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...
Beat Signer
 
1643 y є r relational calculus-1
1643 y є r  relational calculus-11643 y є r  relational calculus-1
1643 y є r relational calculus-1
Dr Fereidoun Dejahang
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculus
Salman Vadsarya
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMSkoolkampus
 
Relational Model - An Introduction
Relational Model - An IntroductionRelational Model - An Introduction
Relational Model - An Introduction
Rajeev Srivastava
 
Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2
Eddyzulham Mahluzydde
 
DBMS _Relational model
DBMS _Relational modelDBMS _Relational model
DBMS _Relational model
Azizul Mamun
 
Ch2
Ch2Ch2
Ch3
Ch3Ch3
Ch3 a
Ch3 aCh3 a
Relational Model
Relational ModelRelational Model
Relational Model
A. S. M. Shafi
 

What's hot (20)

Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra Operations
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
 
Relational Algebra Introduction
Relational Algebra IntroductionRelational Algebra Introduction
Relational Algebra Introduction
 
Chapter-7 Relational Calculus
Chapter-7 Relational CalculusChapter-7 Relational Calculus
Chapter-7 Relational Calculus
 
Relational model
Relational modelRelational model
Relational model
 
Understanding databases and querying
Understanding databases and queryingUnderstanding databases and querying
Understanding databases and querying
 
Intro to relational model
Intro to relational modelIntro to relational model
Intro to relational model
 
5 the relational algebra and calculus
5 the relational algebra and calculus5 the relational algebra and calculus
5 the relational algebra and calculus
 
Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...
Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...
Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...
 
1643 y є r relational calculus-1
1643 y є r  relational calculus-11643 y є r  relational calculus-1
1643 y є r relational calculus-1
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculus
 
Relational+algebra (1)
Relational+algebra (1)Relational+algebra (1)
Relational+algebra (1)
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMS
 
Relational Model - An Introduction
Relational Model - An IntroductionRelational Model - An Introduction
Relational Model - An Introduction
 
Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2
 
DBMS _Relational model
DBMS _Relational modelDBMS _Relational model
DBMS _Relational model
 
Ch2
Ch2Ch2
Ch2
 
Ch3
Ch3Ch3
Ch3
 
Ch3 a
Ch3 aCh3 a
Ch3 a
 
Relational Model
Relational ModelRelational Model
Relational Model
 

Similar to Relational model

7.relational model
7.relational model7.relational model
7.relational model
raghuinfo
 
4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf
LPhct2
 
Relational Model on Database management PPT
Relational Model on Database management PPTRelational Model on Database management PPT
Relational Model on Database management PPT
ssuser3e0f731
 
Relational model
Relational modelRelational model
Relational model
Sabana Maharjan
 
Dbms relational data model and sql queries
Dbms relational data model and sql queries Dbms relational data model and sql queries
Dbms relational data model and sql queries
Tetala Vishnu Vardhan Reddy
 
Relational model
Relational modelRelational model
Relational model
Dabbal Singh Mahara
 
relational algebra and it's implementation
relational algebra and it's implementationrelational algebra and it's implementation
relational algebra and it's implementation
dbmscse61
 
Dbms chapter vii
Dbms chapter viiDbms chapter vii
Dbms chapter vii
Bala Ganesh
 
Module 2 - part i
Module   2 - part iModule   2 - part i
Module 2 - part i
ParthNavale
 
DBMS Unit-2.pdf
DBMS Unit-2.pdfDBMS Unit-2.pdf
DBMS Unit-2.pdf
vaishnavi339314
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
Amin Omi
 
RDBMS
RDBMSRDBMS
RDBMS
NilaNila16
 
relational model in Database Management.ppt.ppt
relational model in Database Management.ppt.pptrelational model in Database Management.ppt.ppt
relational model in Database Management.ppt.ppt
Roshni814224
 
Er to tables
Er to tablesEr to tables
Er to tables
GGCMP3R
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.ppt
Computer57
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.ppt
Prabhat106214
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.ppt
UsmanKhan373891
 
18306_lec-2 (1).ppt
18306_lec-2 (1).ppt18306_lec-2 (1).ppt
18306_lec-2 (1).ppt
IshuIswarya3
 

Similar to Relational model (20)

7.relational model
7.relational model7.relational model
7.relational model
 
4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf
 
Unit04 dbms
Unit04 dbmsUnit04 dbms
Unit04 dbms
 
Relational Model on Database management PPT
Relational Model on Database management PPTRelational Model on Database management PPT
Relational Model on Database management PPT
 
Relational model
Relational modelRelational model
Relational model
 
Dbms relational data model and sql queries
Dbms relational data model and sql queries Dbms relational data model and sql queries
Dbms relational data model and sql queries
 
Relational model
Relational modelRelational model
Relational model
 
relational algebra and it's implementation
relational algebra and it's implementationrelational algebra and it's implementation
relational algebra and it's implementation
 
Dbms chapter vii
Dbms chapter viiDbms chapter vii
Dbms chapter vii
 
Module 2 - part i
Module   2 - part iModule   2 - part i
Module 2 - part i
 
DBMS Unit-2.pdf
DBMS Unit-2.pdfDBMS Unit-2.pdf
DBMS Unit-2.pdf
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
 
RDBMS
RDBMSRDBMS
RDBMS
 
relational model in Database Management.ppt.ppt
relational model in Database Management.ppt.pptrelational model in Database Management.ppt.ppt
relational model in Database Management.ppt.ppt
 
Er to tables
Er to tablesEr to tables
Er to tables
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.ppt
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.ppt
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.ppt
 
18306_lec-2 (1).ppt
18306_lec-2 (1).ppt18306_lec-2 (1).ppt
18306_lec-2 (1).ppt
 
Unit 04 dbms
Unit 04 dbmsUnit 04 dbms
Unit 04 dbms
 

More from RUpaliLohar

Lecture 08 mapping-converted
Lecture 08 mapping-convertedLecture 08 mapping-converted
Lecture 08 mapping-converted
RUpaliLohar
 
Mobile ip
Mobile ipMobile ip
Mobile ip
RUpaliLohar
 
Mac
MacMac
gprs
gprsgprs
Dbms keys
Dbms keysDbms keys
Dbms keys
RUpaliLohar
 
EER MODEL
EER MODELEER MODEL
EER MODEL
RUpaliLohar
 
Gsm security algorithms A3 , A5 , A8
Gsm security algorithms A3 , A5 , A8Gsm security algorithms A3 , A5 , A8
Gsm security algorithms A3 , A5 , A8
RUpaliLohar
 
Localization & calling
Localization  & callingLocalization  & calling
Localization & calling
RUpaliLohar
 
Gsm signaling protocol
Gsm signaling protocolGsm signaling protocol
Gsm signaling protocol
RUpaliLohar
 
Mapping cardinality (cardinality constraint) in ER MODEL
Mapping cardinality (cardinality constraint) in ER MODELMapping cardinality (cardinality constraint) in ER MODEL
Mapping cardinality (cardinality constraint) in ER MODEL
RUpaliLohar
 
GSM Radio interface
GSM Radio interfaceGSM Radio interface
GSM Radio interface
RUpaliLohar
 
Gsm services
Gsm servicesGsm services
Gsm services
RUpaliLohar
 
Electromagnetic wave
Electromagnetic waveElectromagnetic wave
Electromagnetic wave
RUpaliLohar
 
Gsm architecture
Gsm architectureGsm architecture
Gsm architecture
RUpaliLohar
 
Entity relationship model
Entity relationship modelEntity relationship model
Entity relationship model
RUpaliLohar
 
Spread spectrum
Spread spectrumSpread spectrum
Spread spectrum
RUpaliLohar
 
Data model
Data modelData model
Data model
RUpaliLohar
 
DBMS architecture &; system structure
DBMS architecture &; system  structureDBMS architecture &; system  structure
DBMS architecture &; system structure
RUpaliLohar
 
Introduction of dbms
Introduction of dbmsIntroduction of dbms
Introduction of dbms
RUpaliLohar
 
Multiplexing
Multiplexing Multiplexing
Multiplexing
RUpaliLohar
 

More from RUpaliLohar (20)

Lecture 08 mapping-converted
Lecture 08 mapping-convertedLecture 08 mapping-converted
Lecture 08 mapping-converted
 
Mobile ip
Mobile ipMobile ip
Mobile ip
 
Mac
MacMac
Mac
 
gprs
gprsgprs
gprs
 
Dbms keys
Dbms keysDbms keys
Dbms keys
 
EER MODEL
EER MODELEER MODEL
EER MODEL
 
Gsm security algorithms A3 , A5 , A8
Gsm security algorithms A3 , A5 , A8Gsm security algorithms A3 , A5 , A8
Gsm security algorithms A3 , A5 , A8
 
Localization & calling
Localization  & callingLocalization  & calling
Localization & calling
 
Gsm signaling protocol
Gsm signaling protocolGsm signaling protocol
Gsm signaling protocol
 
Mapping cardinality (cardinality constraint) in ER MODEL
Mapping cardinality (cardinality constraint) in ER MODELMapping cardinality (cardinality constraint) in ER MODEL
Mapping cardinality (cardinality constraint) in ER MODEL
 
GSM Radio interface
GSM Radio interfaceGSM Radio interface
GSM Radio interface
 
Gsm services
Gsm servicesGsm services
Gsm services
 
Electromagnetic wave
Electromagnetic waveElectromagnetic wave
Electromagnetic wave
 
Gsm architecture
Gsm architectureGsm architecture
Gsm architecture
 
Entity relationship model
Entity relationship modelEntity relationship model
Entity relationship model
 
Spread spectrum
Spread spectrumSpread spectrum
Spread spectrum
 
Data model
Data modelData model
Data model
 
DBMS architecture &; system structure
DBMS architecture &; system  structureDBMS architecture &; system  structure
DBMS architecture &; system structure
 
Introduction of dbms
Introduction of dbmsIntroduction of dbms
Introduction of dbms
 
Multiplexing
Multiplexing Multiplexing
Multiplexing
 

Recently uploaded

HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 

Recently uploaded (20)

HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 

Relational model

  • 1. Relational Model Asst.Prof. Rupali Lohar Dept. of Computer Science & Engineering B. R. Harne College Of Engineering & Technology, Karav, Post Vangani (W Tal Ambernath, Mumbai, Maharashtra 421503
  • 2. S# SNAME STATUS CITY S1 Smith 20 London S2 Jones 10 Paris S3 Blake 30 Paris S4 Clark 20 London S5 Adams 30 Athens 2  Relational Databases  represent data as a collection of tables  each row in a table represents a collection of related values Example Supplier S
  • 3. Relational Model – 3  Tables (relations)  Rows (tuples)  Columns (attributes)  tuples  No duplicate tuples  Domains
  • 4. Relational Data Structure 4  Table is the Data Structure for relational model  Relation = Table  name of this relation is S.  Tuple = Row  This relation has 5 tuples  Each tuple represents a record of one supplier, so tuples are seldom called records also. S# SNAME STATUS CITY S1 Smith 20 London S2 Jones 10 Paris S3 Blake 30 Paris S4 Clark 20 London S5 Adams 30 Athens Supplier S
  • 5. Relational Data Structure 5  Cardinality = # of rows with data in the relation  so for S, cardinality = 5.  Attribute = Columns or fields.  Degree = # of columns or fields of a relation.  The relation S has a degree of 4. S# SNAME STATUS CITY S1 Smith 20 London S2 Jones 10 Paris S3 Blake 30 Paris S4 Clark 20 London S5 Adams 30 Athens Supplier S
  • 6. Relational Data Structure 6  Domain = A pool of legal values  For example:  For S# we have S followed by a positive number.  For Year we might have a four digit positive number between 1000 and 2003.  Primary Key = A unique identifier, used to identify one specific record from among all other records. S# SNAME STATUS CITY S1 Smith 20 London S2 Jones 10 Paris S3 Blake 30 Paris S4 Clark 20 London S5 Adams 30 Athens Supplier S
  • 7. Relations 7  A relation consists of 2 parts  Heading:  Consists of a fixed set of attributes or columns or fields.  Body  Consists of the tuples or rows or records.  Time varying set, i.e., at different intervals of time there may be different contents in the body of a relation.
  • 8. Key Properties of Relations 8  No Duplicate tuples  In other words, not all fields are same  All cells have a single value  A relation which follows this rule is said to be in the first normal form.
  • 9. Structure of Relational Database • Basic Structure – The relational model uses a collection of tables. – These tables have multiple columns, and each column has a unique name called attributes. – The set of allowed values for each attribute is called the domain of the attribute – whether the tuples of a relation are listed in sorted order, as in Figure 1, or are unsorted, as in Figure 2, does not matter The account relation. 9 The account relation with unordered tuples.
  • 10. Structure of Relational Database • Database Schema The customer relation The branch relation.. The account relation. The depositor relation. The loan relation. 10 The borrower relation.
  • 12. 12 Structure of Relational Database • Schema Diagram – A database schema, along with primary key and foreign key dependencies, can be depicted pictorially by schema diagrams. • Each relation appears as a box, with the attributes listed inside it and the relation name above it. • If there are primary key attributes, a horizontal line crosses the box, with the primary key attributes listed above the line. • Foreign key dependencies appear as arrows from the foreign key attributes of the referencing relation to the primary key of the referenced relation.
  • 13. • Schema Diagram – Figure shows the schema diagram for our banking enterprise. 13
  • 14. ER Model to Relational Model • ER diagrams can be mapped to relational schema, that is, it is possible to create relational schema using ER diagram. We cannot import all the ER constraints into relational model, but an approximate schema can be generated.
  • 15. Mapping Entity Mapping Process (Algorithm) • Create table for each entity. • Entity's attributes should become fields of tables with their respective data types. • Declare primary key.
  • 16. Mapping Relationship Mapping Process • Create table for a relationship. • Add the primary keys of all participating Entities as fields of table with their respective data types. • If relationship has any attribute, add each attribute as field of table. • Declare a primary key composing all the primary keys of participating entities. • Declare all foreign key constraints.
  • 17. Mapping Weak Entity Sets Mapping Process • Create table for weak entity set. • Add all its attributes to table as field. • Add the primary key of identifying entity set. • Declare all foreign key constraints.
  • 18. Mapping Hierarchical Entities ER specialization or generalization comes in the form of hierarchical entity sets. Mapping Process • Create tables for all higher-level entities. • Create tables for lower-level entities. • Add primary keys of higher-level entities in the table of lower-level entities. • In lower-level tables, add all other attributes of lower-level entities. • Declare primary key of higher-level table and the primary key for lower- level table. • Declare foreign key constraints.
  • 19. E-R Diagram for Banking Example depositorcustomer customer_name customer_city customer_street account_number account branch_name balance loan branch_name loan_number amount borrower branch_name branch branch_city assets account_ brach loan_ branch 1 9
  • 20. Reduction of an E-R Diagram to Relational Schemas • Representation of Strong Entity Sets  Example customer customer_name customer_city customer_street customer_name customer_street customer_city 2 0 The relation customer
  • 21. Reduction of an E-R Diagram to Relational Schemas loan_pay ment loan payment • Representation of Weak Entity Sets  Example branch_name payment_date loan_number amount payment_number payment_amount loan_number payment_number payment_date payment_amount 2 1 The relation payment
  • 22. Reduction of an E-R Diagram to Relational Schemas customer depositor account • Tabular Representation of Relationship Sets  Example access_date customer_street branch_name customer_name customer_city account_number balance customer_name account_number access_date 8TMhrse.SrueniltaaMtioDonl,WdeIT,pSoolaspiutror
  • 23. Reduction of an E-R Diagram to Relational Schemas • Tabular Representation of Relationship Sets  Combination of Tables Example : we can combine the table for account-branch with the table for account and require only the following two tables: account, with attributes account-number, balance, and branch-name branch, with attributes branch-name, branch-city, and assets account_number account branch_name branch_name branch branch_city assets account_ brach balance 14Mrs. Sunita M Dol, WIT,Solapur
  • 24. Reduction of an E-R Diagram to Relational Schemas • Composite Attributes  We handle composite attributes by creating a separate attribute for each of the component attributes; we do not create a separate column for the composite attribute itself.  Suppose address is a composite attribute of entity set customer, and the components of address are street and city. The table generated from customer would then contain columns address-street and address-city; there is no separate column for address 15Mrs. Sunita M Dol, WIT,Solapur
  • 25. Reduction of an E-R Diagram to Relational Schemas • Composite Attributes  Example customer_name customer address phone_number Street city customer_name customer_street customer_city phone_number 16TMhrse.SrueniltaaMtioDonl,WcuIT,sStoolampurer
  • 26. Reduction of an E-R Diagram to Relational Schemas • Multivalued Attributes  For a multivalued attribute M, we create a table T with a column C that corresponds to M and columns corresponding to the primary key of the entity set or relationship set of which M is an attribute. 17
  • 27. Reduction of an E-R Diagram to Relational Schemas• MultivaluedAttributes  Example: For the multivalued attribute dependent-name, we create a table dependent-name, with columns dname, referring to the dependent-name attribute of employee, and employee-id, representing the primary key of the entity set employee. Each dependent of an employee is represented as a unique row in the table. dname employee_id The relation dependent_name 18
  • 28. Advantages of Relational Model • Simple • Scalable • Structural Independence Disadvantages of Relational Model • Hardware Overheads: more powerful hardware computers and data storage devices. • Bad Design: As the relational model is very easy to design and use. So the users don't need to know how the data is stored in order to access it.