SlideShare a Scribd company logo
UNIT-II
RELATIONAL DATA MODEL AND LANGUAGE
Relational Data Model
'The 'Relational Database Model is the most common model in industry today.
A relational database is based on the relational model developed by E.F. Codd.
A relational database allows the definition of data structures, storage and retrieval operations
and integrity constraints. In such a database the data and relations between them are organized
into tables. A table is a collection of records and each record in a table contains the same fields.
Properties of the Relational database
model
Properties of Relational Tables:
1. Data is presented as a collection of relations.
2. Each relation is depicted as a table.
3. Columns are attributes that belong to the entity modelled by the table (ex. In a student
table, you could have name, address, student ID, major, etc.).
4. Each row ("tuple") represents a single entity (ex. In a student table, John Smith, 14 Oak St,
9002342, Accounting, would represent one student entity).
5. Every table has a set of attributes that taken together as a "key" (technically, a "superkey")
uniquely identifies each entity (Ex. In the student table, “student ID” would uniquely identify
each student – no two students would have the same student ID).
Concepts
Tables − In relational data model, relations are saved in the format of Tables. This format stores
the relation among entities. A table has rows and columns, where rows represents records and
columns represent the attributes.
Tuple − A single row of a table, which contains a single record for that relation is called a tuple.
Relation instance − A finite set of tuples in the relational database system represents relation
instance. Relation instances do not have duplicate tuples.
Relation schema − A relation schema describes the relation name (table name), attributes, and
their names.
Relation key − Each row has one or more attributes, known as relation key, which can identify
the row in the relation (table) uniquely.
Attribute domain − Every attribute has some pre-defined value scope, known as attribute
domain.
Relational Integrity Constraints
Every relation has some conditions that must hold for it to be a valid relation. These conditions
are called Relational Integrity Constraints. There are three main integrity constraints −
1. Key constraints
2. Domain constraints
3. Referential integrity constraints
Example
The diagram below shows a
conceptual model with two
associations: WrittenBy and
PublishedBy. The Book entity
type has a property, PublisherId,
that references the entity key of
the Publisher entity type when
you define a referential integrity
constrainst on the PublishedBy
association.
Key Constraints
There must be at least one minimal subset of attributes in the relation, which can identify a
tuple uniquely. This minimal subset of attributes is called key for that relation. If there are more
than one such minimal subsets, these are called candidate keys.
Key constraints force that −
in a relation with a key attribute, no two tuples can have identical values for key attributes.
a key attribute can not have NULL values.
Key constraints are also referred to as Entity Constraints.
Domain Constraints
Attributes have specific values in real-world scenario. For example, age can only be a positive
integer. The same constraints have been tried to employ on the attributes of a relation. Every
attribute is bound to have a specific range of values. For example, age cannot be less than zero
and telephone numbers cannot contain a digit outside 0-9.
Referential Integrity Constraints
Referential integrity constraints work on the concept of Foreign Keys. A foreign key is a key
attribute of a relation that can be referred in other relation.
Referential integrity constraint states that if a relation refers to a key attribute of a different or
same relation, then that key element must exist.
…
Referential integrity is a property of data which, when
satisfied, requires every value of one attribute (column)
of a relation (table) to exist as a value of another
attribute (column) in a different (or the same) relation
(table).
A foreign key (FK) is a column or combination of columns
that is used to establish and enforce a link between the
data in two tables.
Integrity
Data integrity refers to maintaining and assuring the
accuracy and consistency of data over its entire life-cycle,
and is a critical aspect to the design, implementation and
usage of any system which stores, processes, or retrieves
data.
Relational Database
Relational database systems are expected to be equipped with a query language that can assist
its users to query the database instances.
There are two kinds of query languages −
1. Relational algebra
2. Relational calculus.
Relational Algebra
The main application of relational algebra is providing a theoretical foundation for relational
databases, particularly query languages for such databases, chief among which is SQL.
Relational algebra is a theoritcal procedural query language, which takes instances of relations as
input and yields instances of relations as output. It uses operators to perform queries. An
operator can be either unary or binary. They accept relations as their input and yield relations as
their output. Relational algebra is performed recursively on a relation and intermediate results
are also considered relations.
The fundamental operations of relational algebra are as follows −
Select Project Union
Set Difference Cartesian product Rename
Select Operation (σ)
It selects tuples that satisfy the given predicate from a relation.
Notation − σp(r)
Where σ stands for selection predicate and r stands for relation. p is prepositional logic formula which may use
connectors like and, or, and not. These terms may use relational operators like − =, ≠, ≥, < , >, ≤.
For example −
σsubject = "database"(Books)
Output − Selects tuples from books where subject is 'database'.
σsubject = "database" and price = "450"(Books)
Output − Selects tuples from books where subject is 'database' and 'price' is 450.
σsubject = "database" and price = "450" or year > "2010"(Books)
Output − Selects tuples from books where subject is 'database' and 'price' is 450 or those books
published after 2010.
Project Operation (∏)
It projects column(s) that satisfy a given predicate.
Notation − ∏A1, A2, An (r)
Where A1, A2 , An are attribute names of relation r.
Duplicate rows are automatically eliminated, as relation is a set.
For example −
∏subject, author (Books)
◦ Output: Selects and projects columns named as subject and author from the relation Books.
Union Operation (∪)
It performs binary union between two given relations and is defined as −
Notation − r U s
Where r and s are either database relations or relation result set (temporary relation).
For a union operation to be valid, the following conditions must hold −
◦ r, and s must have the same number of attributes.
◦ Attribute domains must be compatible.
◦ Duplicate tuples are automatically eliminated.
For Example: ∏ author (Books) ∪ ∏ author (Articles)
◦ Output − Projects the names of the authors who have either written a book or an article or both.
Set Difference (−)
The result of set difference operation is tuples, which are present in one relation but are not in
the second relation.
Notation − r − s
Finds all the tuples that are present in r but not in s.
For Example: ∏ author (Books) − ∏ author (Articles)
◦ Output − Provides the name of authors who have written books but not articles.
Cartesian Product (Χ)
Combines information of two different relations into one.
Notation − r Χ s
Where r and s are relations and their output will be defined as −
σauthor = ‘nishant'(Books Χ Articles)
◦ Output − Yields a relation, which shows all the books and articles written by nishant.
Rename Operation (ρ)
The results of relational algebra are also relations but without any name. The rename operation
allows us to rename the output relation. 'rename' operation is denoted with small Greek letter
rho ρ.
Notation − ρ x (E)
Where the result of expression E is saved with name of x.
Relational Calculus
In contrast to Relational Algebra, Relational Calculus is a non-procedural query language, that is,
it tells what to do but never explains how to do it.
Relational calculus exists in two forms
◦ Tuple Relational Calculus (TRC)
◦ Domain Relational Calculus (DRC)
Tuple Relational Calculus
Filtering variable ranges over tuples.
Notation − {T | Condition}
Returns all tuples T that satisfies a condition.
For example −
{ T.name | Author(T) AND T.article = 'database' }
Output − Returns tuples with 'name' from Author who has written article on 'database'.
Domain Relational Calculus (DRC)
In DRC, the filtering variable uses the domain of attributes instead of entire tuple values (as
done in TRC, mentioned above).
Notation −
{ a1, a2, a3, ..., an | P (a1, a2, a3, ... ,an)}
Where a1, a2 are attributes and P stands for formulae built by inner attributes.
For example − {< article, page, subject > | ∈ Sahoo ∧ subject = 'database'}
Output − Yields Article, Page, and Subject from the relation Sahoo, where subject is database.
THANKSConnect: @nishantmunjal
Ad

More Related Content

What's hot (20)

Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
Shakila Mahjabin
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
Naresh Kumar
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
Saranya Natarajan
 
ER MODEL
ER MODELER MODEL
ER MODEL
Rupali Rana
 
Data Modeling PPT
Data Modeling PPTData Modeling PPT
Data Modeling PPT
Trinath
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMS
PadamNepal1
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
koolkampus
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
Smriti Jain
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
koolkampus
 
Data Models
Data ModelsData Models
Data Models
RituBhargava7
 
joins in database
 joins in database joins in database
joins in database
Sultan Arshad
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
Slideshare
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
BIT Durg
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
Kabindra Koirala
 
Schema
SchemaSchema
Schema
Pragya Srivastava
 
Relational Algebra,Types of join
Relational Algebra,Types of joinRelational Algebra,Types of join
Relational Algebra,Types of join
raj upadhyay
 
Entity Relationship Diagrams
Entity Relationship DiagramsEntity Relationship Diagrams
Entity Relationship Diagrams
sadique_ghitm
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
Megha yadav
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
Nishant Munjal
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
VENNILAV6
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
Shakila Mahjabin
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
Naresh Kumar
 
Data Modeling PPT
Data Modeling PPTData Modeling PPT
Data Modeling PPT
Trinath
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMS
PadamNepal1
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
koolkampus
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
Smriti Jain
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
koolkampus
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
Slideshare
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
BIT Durg
 
Relational Algebra,Types of join
Relational Algebra,Types of joinRelational Algebra,Types of join
Relational Algebra,Types of join
raj upadhyay
 
Entity Relationship Diagrams
Entity Relationship DiagramsEntity Relationship Diagrams
Entity Relationship Diagrams
sadique_ghitm
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
Megha yadav
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
Nishant Munjal
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
VENNILAV6
 

Viewers also liked (20)

Database Management System
Database Management SystemDatabase Management System
Database Management System
Nishant Munjal
 
Chapter 6 relational data model and relational
Chapter  6  relational data model and relationalChapter  6  relational data model and relational
Chapter 6 relational data model and relational
Jafar Nesargi
 
Rdbms
RdbmsRdbms
Rdbms
tech4us
 
4 the relational data model and relational database constraints
4 the relational data model and relational database constraints4 the relational data model and relational database constraints
4 the relational data model and relational database constraints
Kumar
 
Sql
SqlSql
Sql
pratik201289
 
Bluemix Introduction
Bluemix IntroductionBluemix Introduction
Bluemix Introduction
Nishant Munjal
 
Technical education benchmarks
Technical education benchmarksTechnical education benchmarks
Technical education benchmarks
Nishant Munjal
 
Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03
Jotham Gadot
 
Lecture 4 software process model (2)
Lecture 4   software process model (2)Lecture 4   software process model (2)
Lecture 4 software process model (2)
IIUI
 
Virtualization, A Concept Implementation of Cloud
Virtualization, A Concept Implementation of CloudVirtualization, A Concept Implementation of Cloud
Virtualization, A Concept Implementation of Cloud
Nishant Munjal
 
Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2
eidah20
 
Introduction: Databases and Database Users
Introduction: Databases and Database UsersIntroduction: Databases and Database Users
Introduction: Databases and Database Users
sontumax
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
Vidyasagar Mundroy
 
introduction to database
 introduction to database introduction to database
introduction to database
Akif shexi
 
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3
Eddyzulham Mahluzydde
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
Boopathi K
 
Database Systems - Introduction (Chapter 1)
Database Systems - Introduction (Chapter 1)Database Systems - Introduction (Chapter 1)
Database Systems - Introduction (Chapter 1)
Vidyasagar Mundroy
 
The Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database ConstraintsThe Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database Constraints
sontumax
 
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
 
Implementing an REA Model in a Relational Database (Chapter 16:)
Implementing an REA Model in a Relational Database (Chapter 16:)Implementing an REA Model in a Relational Database (Chapter 16:)
Implementing an REA Model in a Relational Database (Chapter 16:)
foremanjf
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
Nishant Munjal
 
Chapter 6 relational data model and relational
Chapter  6  relational data model and relationalChapter  6  relational data model and relational
Chapter 6 relational data model and relational
Jafar Nesargi
 
4 the relational data model and relational database constraints
4 the relational data model and relational database constraints4 the relational data model and relational database constraints
4 the relational data model and relational database constraints
Kumar
 
Technical education benchmarks
Technical education benchmarksTechnical education benchmarks
Technical education benchmarks
Nishant Munjal
 
Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03
Jotham Gadot
 
Lecture 4 software process model (2)
Lecture 4   software process model (2)Lecture 4   software process model (2)
Lecture 4 software process model (2)
IIUI
 
Virtualization, A Concept Implementation of Cloud
Virtualization, A Concept Implementation of CloudVirtualization, A Concept Implementation of Cloud
Virtualization, A Concept Implementation of Cloud
Nishant Munjal
 
Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2
eidah20
 
Introduction: Databases and Database Users
Introduction: Databases and Database UsersIntroduction: Databases and Database Users
Introduction: Databases and Database Users
sontumax
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
Vidyasagar Mundroy
 
introduction to database
 introduction to database introduction to database
introduction to database
Akif shexi
 
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3
Eddyzulham Mahluzydde
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
Boopathi K
 
Database Systems - Introduction (Chapter 1)
Database Systems - Introduction (Chapter 1)Database Systems - Introduction (Chapter 1)
Database Systems - Introduction (Chapter 1)
Vidyasagar Mundroy
 
The Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database ConstraintsThe Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database Constraints
sontumax
 
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
 
Implementing an REA Model in a Relational Database (Chapter 16:)
Implementing an REA Model in a Relational Database (Chapter 16:)Implementing an REA Model in a Relational Database (Chapter 16:)
Implementing an REA Model in a Relational Database (Chapter 16:)
foremanjf
 
Ad

Similar to Relational Data Model Introduction (20)

The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
Raj vardhan
 
Relational data model
Relational data modelRelational data model
Relational data model
Dr. SURBHI SAROHA
 
RELATIONAL MODEL CONCEPTS.pptx with good explanation
RELATIONAL MODEL CONCEPTS.pptx with good explanationRELATIONAL MODEL CONCEPTS.pptx with good explanation
RELATIONAL MODEL CONCEPTS.pptx with good explanation
farsankadavandy
 
Relational Database Model Database Management system
Relational Database Model Database Management systemRelational Database Model Database Management system
Relational Database Model Database Management system
soalteepaudel
 
Relational Model
Relational ModelRelational Model
Relational Model
A. S. M. Shafi
 
COMPUTERS Database
COMPUTERS Database COMPUTERS Database
COMPUTERS Database
Rc Os
 
The relational data model part[1]
The relational data model part[1]The relational data model part[1]
The relational data model part[1]
Bashir Rezaie
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra Operations
Shefa Idrees
 
Relational Database management Systems unit-II
Relational Database management Systems unit-IIRelational Database management Systems unit-II
Relational Database management Systems unit-II
vanithar32
 
DBMS Module-2 notes for engineering BE vtu
DBMS Module-2 notes for engineering BE vtuDBMS Module-2 notes for engineering BE vtu
DBMS Module-2 notes for engineering BE vtu
shreya520613
 
Relational algebra calculus
Relational algebra  calculusRelational algebra  calculus
Relational algebra calculus
Vaibhav Kathuria
 
Lect - 12 solve d.pptx
Lect - 12 solve                    d.pptxLect - 12 solve                    d.pptx
Lect - 12 solve d.pptx
SumeetRathi5
 
Structure of Z Formal methods Lecture
Structure of Z Formal methods LectureStructure of Z Formal methods Lecture
Structure of Z Formal methods Lecture
Faiz Zeya
 
relational model.pptx
relational model.pptxrelational model.pptx
relational model.pptx
ThangamaniR3
 
Relational model
Relational modelRelational model
Relational model
Sabana Maharjan
 
Database relational model_unit3_2023 (1).pptx
Database relational model_unit3_2023 (1).pptxDatabase relational model_unit3_2023 (1).pptx
Database relational model_unit3_2023 (1).pptx
2021ismadhuprasadrna
 
Fundamentals of database system - Relational data model and relational datab...
Fundamentals of database system  - Relational data model and relational datab...Fundamentals of database system  - Relational data model and relational datab...
Fundamentals of database system - Relational data model and relational datab...
Mustafa Kamel Mohammadi
 
RDBMS
RDBMSRDBMS
RDBMS
NilaNila16
 
Relational database
Relational databaseRelational database
Relational database
Ducat
 
Chapter 6 relational data model and relational
Chapter  6  relational data model and relationalChapter  6  relational data model and relational
Chapter 6 relational data model and relational
Jafar Nesargi
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
Raj vardhan
 
RELATIONAL MODEL CONCEPTS.pptx with good explanation
RELATIONAL MODEL CONCEPTS.pptx with good explanationRELATIONAL MODEL CONCEPTS.pptx with good explanation
RELATIONAL MODEL CONCEPTS.pptx with good explanation
farsankadavandy
 
Relational Database Model Database Management system
Relational Database Model Database Management systemRelational Database Model Database Management system
Relational Database Model Database Management system
soalteepaudel
 
COMPUTERS Database
COMPUTERS Database COMPUTERS Database
COMPUTERS Database
Rc Os
 
The relational data model part[1]
The relational data model part[1]The relational data model part[1]
The relational data model part[1]
Bashir Rezaie
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra Operations
Shefa Idrees
 
Relational Database management Systems unit-II
Relational Database management Systems unit-IIRelational Database management Systems unit-II
Relational Database management Systems unit-II
vanithar32
 
DBMS Module-2 notes for engineering BE vtu
DBMS Module-2 notes for engineering BE vtuDBMS Module-2 notes for engineering BE vtu
DBMS Module-2 notes for engineering BE vtu
shreya520613
 
Relational algebra calculus
Relational algebra  calculusRelational algebra  calculus
Relational algebra calculus
Vaibhav Kathuria
 
Lect - 12 solve d.pptx
Lect - 12 solve                    d.pptxLect - 12 solve                    d.pptx
Lect - 12 solve d.pptx
SumeetRathi5
 
Structure of Z Formal methods Lecture
Structure of Z Formal methods LectureStructure of Z Formal methods Lecture
Structure of Z Formal methods Lecture
Faiz Zeya
 
relational model.pptx
relational model.pptxrelational model.pptx
relational model.pptx
ThangamaniR3
 
Database relational model_unit3_2023 (1).pptx
Database relational model_unit3_2023 (1).pptxDatabase relational model_unit3_2023 (1).pptx
Database relational model_unit3_2023 (1).pptx
2021ismadhuprasadrna
 
Fundamentals of database system - Relational data model and relational datab...
Fundamentals of database system  - Relational data model and relational datab...Fundamentals of database system  - Relational data model and relational datab...
Fundamentals of database system - Relational data model and relational datab...
Mustafa Kamel Mohammadi
 
Relational database
Relational databaseRelational database
Relational database
Ducat
 
Chapter 6 relational data model and relational
Chapter  6  relational data model and relationalChapter  6  relational data model and relational
Chapter 6 relational data model and relational
Jafar Nesargi
 
Ad

More from Nishant Munjal (20)

Database Management System
Database Management SystemDatabase Management System
Database Management System
Nishant Munjal
 
Functions & Recursion
Functions & RecursionFunctions & Recursion
Functions & Recursion
Nishant Munjal
 
Array, string and pointer
Array, string and pointerArray, string and pointer
Array, string and pointer
Nishant Munjal
 
Programming in C
Programming in CProgramming in C
Programming in C
Nishant Munjal
 
Introduction to computers
Introduction to computersIntroduction to computers
Introduction to computers
Nishant Munjal
 
Unix Administration
Unix AdministrationUnix Administration
Unix Administration
Nishant Munjal
 
Shell Programming Concept
Shell Programming ConceptShell Programming Concept
Shell Programming Concept
Nishant Munjal
 
VI Editor
VI EditorVI Editor
VI Editor
Nishant Munjal
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
Nishant Munjal
 
Routing Techniques
Routing TechniquesRouting Techniques
Routing Techniques
Nishant Munjal
 
Asynchronous Transfer Mode
Asynchronous Transfer ModeAsynchronous Transfer Mode
Asynchronous Transfer Mode
Nishant Munjal
 
Overview of Cloud Computing
Overview of Cloud ComputingOverview of Cloud Computing
Overview of Cloud Computing
Nishant Munjal
 
Database Design and Normalization Techniques
Database Design and Normalization TechniquesDatabase Design and Normalization Techniques
Database Design and Normalization Techniques
Nishant Munjal
 
Concurrency Control
Concurrency ControlConcurrency Control
Concurrency Control
Nishant Munjal
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
Nishant Munjal
 
Personnel Management and Industrial Psycology
Personnel Management and Industrial PsycologyPersonnel Management and Industrial Psycology
Personnel Management and Industrial Psycology
Nishant Munjal
 
Marketing Management
Marketing ManagementMarketing Management
Marketing Management
Nishant Munjal
 
Principles of Management
Principles of ManagementPrinciples of Management
Principles of Management
Nishant Munjal
 
Industrial Economics
Industrial EconomicsIndustrial Economics
Industrial Economics
Nishant Munjal
 
Project Closing Process
Project Closing ProcessProject Closing Process
Project Closing Process
Nishant Munjal
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
Nishant Munjal
 
Array, string and pointer
Array, string and pointerArray, string and pointer
Array, string and pointer
Nishant Munjal
 
Introduction to computers
Introduction to computersIntroduction to computers
Introduction to computers
Nishant Munjal
 
Shell Programming Concept
Shell Programming ConceptShell Programming Concept
Shell Programming Concept
Nishant Munjal
 
Asynchronous Transfer Mode
Asynchronous Transfer ModeAsynchronous Transfer Mode
Asynchronous Transfer Mode
Nishant Munjal
 
Overview of Cloud Computing
Overview of Cloud ComputingOverview of Cloud Computing
Overview of Cloud Computing
Nishant Munjal
 
Database Design and Normalization Techniques
Database Design and Normalization TechniquesDatabase Design and Normalization Techniques
Database Design and Normalization Techniques
Nishant Munjal
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
Nishant Munjal
 
Personnel Management and Industrial Psycology
Personnel Management and Industrial PsycologyPersonnel Management and Industrial Psycology
Personnel Management and Industrial Psycology
Nishant Munjal
 
Principles of Management
Principles of ManagementPrinciples of Management
Principles of Management
Nishant Munjal
 
Project Closing Process
Project Closing ProcessProject Closing Process
Project Closing Process
Nishant Munjal
 

Recently uploaded (20)

Upstream_processing of industrial products.pptx
Upstream_processing of industrial products.pptxUpstream_processing of industrial products.pptx
Upstream_processing of industrial products.pptx
KshitijJayswal2
 
Avnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights FlyerAvnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights Flyer
WillDavies22
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.
Kamal Acharya
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
Basic Principles for Electronics Students
Basic Principles for Electronics StudentsBasic Principles for Electronics Students
Basic Principles for Electronics Students
cbdbizdev04
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
"Heaters in Power Plants: Types, Functions, and Performance Analysis"
"Heaters in Power Plants: Types, Functions, and Performance Analysis""Heaters in Power Plants: Types, Functions, and Performance Analysis"
"Heaters in Power Plants: Types, Functions, and Performance Analysis"
Infopitaara
 
Dust Suppressants: A Sustainable Approach to Dust Pollution Control
Dust Suppressants: A Sustainable Approach to Dust Pollution ControlDust Suppressants: A Sustainable Approach to Dust Pollution Control
Dust Suppressants: A Sustainable Approach to Dust Pollution Control
Janapriya Roy
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Gas Power Plant for Power Generation System
Gas Power Plant for Power Generation SystemGas Power Plant for Power Generation System
Gas Power Plant for Power Generation System
JourneyWithMe1
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
Unit III.pptx IT3401 web essentials presentatio
Unit III.pptx IT3401 web essentials presentatioUnit III.pptx IT3401 web essentials presentatio
Unit III.pptx IT3401 web essentials presentatio
lakshitakumar291
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
Upstream_processing of industrial products.pptx
Upstream_processing of industrial products.pptxUpstream_processing of industrial products.pptx
Upstream_processing of industrial products.pptx
KshitijJayswal2
 
Avnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights FlyerAvnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights Flyer
WillDavies22
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.
Kamal Acharya
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
Basic Principles for Electronics Students
Basic Principles for Electronics StudentsBasic Principles for Electronics Students
Basic Principles for Electronics Students
cbdbizdev04
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
"Heaters in Power Plants: Types, Functions, and Performance Analysis"
"Heaters in Power Plants: Types, Functions, and Performance Analysis""Heaters in Power Plants: Types, Functions, and Performance Analysis"
"Heaters in Power Plants: Types, Functions, and Performance Analysis"
Infopitaara
 
Dust Suppressants: A Sustainable Approach to Dust Pollution Control
Dust Suppressants: A Sustainable Approach to Dust Pollution ControlDust Suppressants: A Sustainable Approach to Dust Pollution Control
Dust Suppressants: A Sustainable Approach to Dust Pollution Control
Janapriya Roy
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Gas Power Plant for Power Generation System
Gas Power Plant for Power Generation SystemGas Power Plant for Power Generation System
Gas Power Plant for Power Generation System
JourneyWithMe1
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
Unit III.pptx IT3401 web essentials presentatio
Unit III.pptx IT3401 web essentials presentatioUnit III.pptx IT3401 web essentials presentatio
Unit III.pptx IT3401 web essentials presentatio
lakshitakumar291
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 

Relational Data Model Introduction

  • 2. Relational Data Model 'The 'Relational Database Model is the most common model in industry today. A relational database is based on the relational model developed by E.F. Codd. A relational database allows the definition of data structures, storage and retrieval operations and integrity constraints. In such a database the data and relations between them are organized into tables. A table is a collection of records and each record in a table contains the same fields.
  • 3. Properties of the Relational database model Properties of Relational Tables: 1. Data is presented as a collection of relations. 2. Each relation is depicted as a table. 3. Columns are attributes that belong to the entity modelled by the table (ex. In a student table, you could have name, address, student ID, major, etc.). 4. Each row ("tuple") represents a single entity (ex. In a student table, John Smith, 14 Oak St, 9002342, Accounting, would represent one student entity). 5. Every table has a set of attributes that taken together as a "key" (technically, a "superkey") uniquely identifies each entity (Ex. In the student table, “student ID” would uniquely identify each student – no two students would have the same student ID).
  • 4. Concepts Tables − In relational data model, relations are saved in the format of Tables. This format stores the relation among entities. A table has rows and columns, where rows represents records and columns represent the attributes. Tuple − A single row of a table, which contains a single record for that relation is called a tuple. Relation instance − A finite set of tuples in the relational database system represents relation instance. Relation instances do not have duplicate tuples. Relation schema − A relation schema describes the relation name (table name), attributes, and their names. Relation key − Each row has one or more attributes, known as relation key, which can identify the row in the relation (table) uniquely. Attribute domain − Every attribute has some pre-defined value scope, known as attribute domain.
  • 5. Relational Integrity Constraints Every relation has some conditions that must hold for it to be a valid relation. These conditions are called Relational Integrity Constraints. There are three main integrity constraints − 1. Key constraints 2. Domain constraints 3. Referential integrity constraints
  • 6. Example The diagram below shows a conceptual model with two associations: WrittenBy and PublishedBy. The Book entity type has a property, PublisherId, that references the entity key of the Publisher entity type when you define a referential integrity constrainst on the PublishedBy association.
  • 7. Key Constraints There must be at least one minimal subset of attributes in the relation, which can identify a tuple uniquely. This minimal subset of attributes is called key for that relation. If there are more than one such minimal subsets, these are called candidate keys. Key constraints force that − in a relation with a key attribute, no two tuples can have identical values for key attributes. a key attribute can not have NULL values. Key constraints are also referred to as Entity Constraints.
  • 8. Domain Constraints Attributes have specific values in real-world scenario. For example, age can only be a positive integer. The same constraints have been tried to employ on the attributes of a relation. Every attribute is bound to have a specific range of values. For example, age cannot be less than zero and telephone numbers cannot contain a digit outside 0-9. Referential Integrity Constraints Referential integrity constraints work on the concept of Foreign Keys. A foreign key is a key attribute of a relation that can be referred in other relation. Referential integrity constraint states that if a relation refers to a key attribute of a different or same relation, then that key element must exist.
  • 9. … Referential integrity is a property of data which, when satisfied, requires every value of one attribute (column) of a relation (table) to exist as a value of another attribute (column) in a different (or the same) relation (table). A foreign key (FK) is a column or combination of columns that is used to establish and enforce a link between the data in two tables. Integrity Data integrity refers to maintaining and assuring the accuracy and consistency of data over its entire life-cycle, and is a critical aspect to the design, implementation and usage of any system which stores, processes, or retrieves data.
  • 10. Relational Database Relational database systems are expected to be equipped with a query language that can assist its users to query the database instances. There are two kinds of query languages − 1. Relational algebra 2. Relational calculus.
  • 11. Relational Algebra The main application of relational algebra is providing a theoretical foundation for relational databases, particularly query languages for such databases, chief among which is SQL. Relational algebra is a theoritcal procedural query language, which takes instances of relations as input and yields instances of relations as output. It uses operators to perform queries. An operator can be either unary or binary. They accept relations as their input and yield relations as their output. Relational algebra is performed recursively on a relation and intermediate results are also considered relations. The fundamental operations of relational algebra are as follows − Select Project Union Set Difference Cartesian product Rename
  • 12. Select Operation (σ) It selects tuples that satisfy the given predicate from a relation. Notation − σp(r) Where σ stands for selection predicate and r stands for relation. p is prepositional logic formula which may use connectors like and, or, and not. These terms may use relational operators like − =, ≠, ≥, < , >, ≤. For example − σsubject = "database"(Books) Output − Selects tuples from books where subject is 'database'. σsubject = "database" and price = "450"(Books) Output − Selects tuples from books where subject is 'database' and 'price' is 450. σsubject = "database" and price = "450" or year > "2010"(Books) Output − Selects tuples from books where subject is 'database' and 'price' is 450 or those books published after 2010.
  • 13. Project Operation (∏) It projects column(s) that satisfy a given predicate. Notation − ∏A1, A2, An (r) Where A1, A2 , An are attribute names of relation r. Duplicate rows are automatically eliminated, as relation is a set. For example − ∏subject, author (Books) ◦ Output: Selects and projects columns named as subject and author from the relation Books.
  • 14. Union Operation (∪) It performs binary union between two given relations and is defined as − Notation − r U s Where r and s are either database relations or relation result set (temporary relation). For a union operation to be valid, the following conditions must hold − ◦ r, and s must have the same number of attributes. ◦ Attribute domains must be compatible. ◦ Duplicate tuples are automatically eliminated. For Example: ∏ author (Books) ∪ ∏ author (Articles) ◦ Output − Projects the names of the authors who have either written a book or an article or both.
  • 15. Set Difference (−) The result of set difference operation is tuples, which are present in one relation but are not in the second relation. Notation − r − s Finds all the tuples that are present in r but not in s. For Example: ∏ author (Books) − ∏ author (Articles) ◦ Output − Provides the name of authors who have written books but not articles.
  • 16. Cartesian Product (Χ) Combines information of two different relations into one. Notation − r Χ s Where r and s are relations and their output will be defined as − σauthor = ‘nishant'(Books Χ Articles) ◦ Output − Yields a relation, which shows all the books and articles written by nishant.
  • 17. Rename Operation (ρ) The results of relational algebra are also relations but without any name. The rename operation allows us to rename the output relation. 'rename' operation is denoted with small Greek letter rho ρ. Notation − ρ x (E) Where the result of expression E is saved with name of x.
  • 18. Relational Calculus In contrast to Relational Algebra, Relational Calculus is a non-procedural query language, that is, it tells what to do but never explains how to do it. Relational calculus exists in two forms ◦ Tuple Relational Calculus (TRC) ◦ Domain Relational Calculus (DRC)
  • 19. Tuple Relational Calculus Filtering variable ranges over tuples. Notation − {T | Condition} Returns all tuples T that satisfies a condition. For example − { T.name | Author(T) AND T.article = 'database' } Output − Returns tuples with 'name' from Author who has written article on 'database'.
  • 20. Domain Relational Calculus (DRC) In DRC, the filtering variable uses the domain of attributes instead of entire tuple values (as done in TRC, mentioned above). Notation − { a1, a2, a3, ..., an | P (a1, a2, a3, ... ,an)} Where a1, a2 are attributes and P stands for formulae built by inner attributes. For example − {< article, page, subject > | ∈ Sahoo ∧ subject = 'database'} Output − Yields Article, Page, and Subject from the relation Sahoo, where subject is database.