SlideShare uma empresa Scribd logo
1 de 30
Introduction to Relational Model
Adri Jovin J J, M.Tech., Ph.D.
UITG004- INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS
Outline
 Structure of Relational Databases
 Database Schema
 Keys
 Schema Diagrams
 Relational Query Languages
 The Relational Algebra
October 8, 2021 UITG004 2
Example of a Instructor Relation
attributes
(or columns)
tuples
(or rows)
3
Relation Schema and Instance
 A1, A2, …, An are attributes
 R = (A1, A2, …, An ) is a relation schema
Example:
instructor = (ID, name, dept_name, salary)
 A relation instance r defined over schema R is denoted by r (R).
 The current values a relation are specified by a table
 An element t of relation r is called a tuple and is represented by a row in a table
October 8, 2021 UITG004 4
Attributes
 The set of allowed values for each attribute is called the domain of the attribute
 Attribute values are (normally) required to be atomic; that is, indivisible
 The special value null is a member of every domain. Indicated that the value is “unknown”
 The null value causes complications in the definition of many operations
October 8, 2021 UITG004 5
Relations are Unordered
 Order of tuples is irrelevant (tuples may be stored in an arbitrary order)
 Example: instructor relation with unordered tuples
October 8, 2021 UITG004 6
Database Schema
 Database schema -- is the logical structure of the database.
 Database instance -- is a snapshot of the data in the database at a given instant in time.
 Example:
• schema: instructor (ID, name, dept_name, salary)
• Instance:
October 8, 2021 UITG004 7
Keys
 Let K  R
 K is a superkey of R if values for K are sufficient to identify a unique tuple of each possible relation r(R)
• Example: {ID} and {ID,name} are both superkeys of instructor.
 Superkey K is a candidate key if K is minimal
Example: {ID} is a candidate key for Instructor
 One of the candidate keys is selected to be the primary key.
• Which one?
 Foreign key constraint: Value in one relation must appear in another
• Referencing relation
• Referenced relation
• Example: dept_name in instructor is a foreign key from instructor referencing department
October 8, 2021 UITG004 8
Schema Diagram for University Database
9
Relational Query Languages
 Procedural versus non-procedural, or declarative
 “Pure” languages:
• Relational algebra
• Tuple relational calculus
• Domain relational calculus
 The above 3 pure languages are equivalent in computing power
 We will concentrate in this chapter on relational algebra
• Not Turing-machine equivalent
• Consists of 6 basic operations
October 8, 2021 UITG004 10
Relational Algebra
 A procedural language consisting of a set of operations that take one or two relations as input and produce
a new relation as their result.
 Six basic operators
• select: 
• project: 
• union: 
• set difference: –
• Cartesian product: x
• rename: 
October 8, 2021 UITG004 11
Select Operation
 The select operation selects tuples that satisfy a given predicate.
 Notation:  p (r)
 p is called the selection predicate
 Example: select those tuples of the instructor relation where the instructor is in the “Physics” department.
• Query
 dept_name=“Physics” (instructor)
• Result
October 8, 2021 UITG004 12
Select Operation (Cont.)
 We allow comparisons using
=, , >, . <. 
in the selection predicate.
 We can combine several predicates into a larger predicate by using the connectives:
 (and),  (or),  (not)
 Example: Find the instructors in Physics with a salary greater $90,000, we write:
 dept_name=“Physics”  salary > 90,000 (instructor)
 The select predicate may include comparisons between two attributes.
• Example, find all departments whose name is the same as their building name:
•  dept_name=building (department)
October 8, 2021 UITG004 13
Project Operation
 A unary operation that returns its argument relation, with certain attributes left out.
 Notation:
 A1,A2,A3 ….Ak
(r)
where A1, A2, …, Ak are attribute names and r is a relation name.
 The result is defined as the relation of k columns obtained by erasing the columns that are not listed
 Duplicate rows removed from result, since relations are sets
October 8, 2021 UITG004 14
Project Operation Example
Example: eliminate the dept_name attribute of instructor
Query:
ID, name, salary (instructor)
Result:
October 8, 2021 UITG004 15
Composition of Relational Operations
 The result of a relational-algebra operation is relation and therefore of relational-algebra operations can be
composed together into a relational-algebra expression.
 Consider the query -- Find the names of all instructors in the Physics department.
name( dept_name =“Physics” (instructor))
 Instead of giving the name of a relation as the argument of the projection operation, we give an expression
that evaluates to a relation.
October 8, 2021 UITG004 16
Cartesian-Product Operation
 The Cartesian-product operation (denoted by X) allows us to combine information from any two relations.
 Example: the Cartesian product of the relations instructor and teaches is written as:
instructor X teaches
 We construct a tuple of the result out of each possible pair of tuples: one from the instructor relation and one from the teaches relation
 Since the instructor ID appears in both relations we distinguish between these attribute by attaching to the attribute the name of the
relation from which the attribute originally came.
• instructor.ID
• teaches.ID
October 8, 2021 UITG004 17
The instructor X teaches table
October 8, 2021 UITG004 18
Join Operation
 The Cartesian-Product
instructor X teaches
associates every tuple of instructor with every tuple of teaches.
• Most of the resulting rows have information about instructors who did NOT teach a particular course.
 To get only those tuples of “instructor X teaches “ that pertain to instructors and the courses that they taught, we write:
 instructor.id = teaches.id (instructor x teaches ))
We get only those tuples of “instructor X teaches” that pertain to instructors and the courses that they taught.
 The result of this expression, shown in the next slide
October 8, 2021 UITG004 19
Join Operation (Cont.)
 The table corresponding to:
 instructor.id = teaches.id (instructor x teaches))
October 8, 2021 UITG004 20
Join Operation (Cont.)
 The join operation allows us to combine a select operation and a Cartesian-Product operation into a single
operation.
 Consider relations r (R) and s (S)
 Let “theta” be a predicate on attributes in the schema R “union” S. The join operation r ⋈𝜃 s is defined as
follows:
𝑟 ⋈𝜃 𝑠 = 𝜎𝜃 (𝑟 × 𝑠)
 Thus
 instructor.id = teaches.id (instructor x teaches ))
 Can equivalently be written as
instructor ⋈ Instructor.id = teaches.id teaches.
October 8, 2021 UITG004 21
Union Operation
 The union operation allows us to combine two relations
 Notation: r  s
 For r  s to be valid.
1. r, s must have the same arity (same number of attributes)
2. The attribute domains must be compatible (example: 2nd
column of r deals with the same type of values as does the
2nd column of s)
 Example: to find all courses taught in the Fall 2017 semester, or in the Spring 2018 semester, or in both
course_id ( semester=“Fall” Λ year=2017 (section)) 
course_id ( semester=“Spring” Λ year=2018 (section))
October 8, 2021 UITG004 22
Union Operation (Cont.)
 Result of:
course_id ( semester=“Fall” Λ year=2017 (section)) 
course_id ( semester=“Spring” Λ year=2018 (section))
October 8, 2021 UITG004 23
Set-Intersection Operation
 The set-intersection operation allows us to find tuples that are in both the input relations.
 Notation: r  s
 Assume:
• r, s have the same arity
• attributes of r and s are compatible
 Example: Find the set of all courses taught in both the Fall 2017 and the Spring 2018 semesters.
course_id ( semester=“Fall” Λ year=2017 (section)) 
course_id ( semester=“Spring” Λ year=2018 (section))
• Result
October 8, 2021 UITG004 24
Set Difference Operation
 The set-difference operation allows us to find tuples that are in one relation but are not in another.
 Notation r – s
 Set differences must be taken between compatible relations.
• r and s must have the same arity
• attribute domains of r and s must be compatible
 Example: to find all courses taught in the Fall 2017 semester, but not in the Spring 2018 semester
course_id ( semester=“Fall” Λ year=2017 (section)) −
course_id ( semester=“Spring” Λ year=2018 (section))
October 8, 2021 UITG004 25
The Assignment Operation
 It is convenient at times to write a relational-algebra expression by assigning parts of it to temporary relation
variables.
 The assignment operation is denoted by  and works like assignment in a programming language.
 Example: Find all instructor in the “Physics” and Music department.
Physics   dept_name=“Physics” (instructor)
Music   dept_name=“Music” (instructor)
Physics  Music
 With the assignment operation, a query can be written as a sequential program consisting of a series of assignments
followed by an expression whose value is displayed as the result of the query.
October 8, 2021 UITG004 26
The Rename Operation
 The results of relational-algebra expressions do not have a name that we can use to refer to them. The
rename operator,  , is provided for that purpose
 The expression:
x (E)
returns the result of expression E under the name x
 Another form of the rename operation:
x(A1,A2, .. An) (E)
October 8, 2021 UITG004 27
Equivalent Queries
 There is more than one way to write a query in relational algebra.
 Example: Find information about courses taught by instructors in the Physics department with salary greater
than 90,000
 Query 1
 dept_name=“Physics”  salary > 90,000 (instructor)
 Query 2
 dept_name=“Physics” ( salary > 90.000 (instructor))
 The two queries are not identical; they are, however, equivalent -- they give the same result on any database.
October 8, 2021 UITG004 28
Equivalent Queries
 There is more than one way to write a query in relational algebra.
 Example: Find information about courses taught by instructors in the Physics department
 Query 1
dept_name=“Physics” (instructor ⋈ instructor.ID = teaches.ID teaches)
 Query 2
(dept_name=“Physics” (instructor)) ⋈ instructor.ID = teaches.ID teaches
 The two queries are not identical; they are, however, equivalent -- they give the same result on any
database.
October 8, 2021 UITG004 29
References
Abraham Silberschatz, Henry F. Korth & Sudharshan S (2010). Database System Concepts. 6th Edition, Tata McGraw
Hill.
Acknowledgement:
 The content in this presentation is adopted from the website https://www.db-book.com/. This presentation is used for instructional purpose and not for any
purpose involving monetary profits.
 This presentation adheres to CC BY-SA 4.0, provided any user deriving the contents acknowledge the original authors Abraham Silberschatz, Henry F. Korth &
Sudharshan S
30
October 8, 2021 UITG004

Mais conteúdo relacionado

Mais procurados

Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented RelationshipsTaher Barodawala
 
Schema Integration, View Integration and Database Integration, ER Model & Dia...
Schema Integration, View Integration and Database Integration, ER Model & Dia...Schema Integration, View Integration and Database Integration, ER Model & Dia...
Schema Integration, View Integration and Database Integration, ER Model & Dia...Mobarok Hossen
 
classes & objects introduction
classes & objects introductionclasses & objects introduction
classes & objects introductionKumar
 
Introduction of Database Design and Development
Introduction of Database Design and DevelopmentIntroduction of Database Design and Development
Introduction of Database Design and DevelopmentEr. Nawaraj Bhandari
 
Relational database
Relational databaseRelational database
Relational databaseSanthiNivas
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbmsmaryeem
 
Basic database analysis(database)
Basic database analysis(database)Basic database analysis(database)
Basic database analysis(database)welcometofacebook
 
Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)Vidyasagar Mundroy
 
Object oriented database model
Object oriented database modelObject oriented database model
Object oriented database modelPAQUIAAIZEL
 
Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Nimrakhan89
 
Ch 12 O O D B Dvlpt
Ch 12  O O  D B  DvlptCh 12  O O  D B  Dvlpt
Ch 12 O O D B Dvlptguest8fdbdd
 
Class and object_diagram
Class  and object_diagramClass  and object_diagram
Class and object_diagramSadhana28
 
Summary data modelling
Summary data modellingSummary data modelling
Summary data modellingNovita Sari
 
Chapter-3 Data Modeling using ER Model
Chapter-3 Data Modeling using ER ModelChapter-3 Data Modeling using ER Model
Chapter-3 Data Modeling using ER ModelKunal Anand
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraintsNikhil Deswal
 
Module 5 oodb systems semantic db systems
Module 5 oodb systems  semantic db systemsModule 5 oodb systems  semantic db systems
Module 5 oodb systems semantic db systemsTaher Barodawala
 

Mais procurados (20)

Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented Relationships
 
Schema Integration, View Integration and Database Integration, ER Model & Dia...
Schema Integration, View Integration and Database Integration, ER Model & Dia...Schema Integration, View Integration and Database Integration, ER Model & Dia...
Schema Integration, View Integration and Database Integration, ER Model & Dia...
 
classes & objects introduction
classes & objects introductionclasses & objects introduction
classes & objects introduction
 
Introduction of Database Design and Development
Introduction of Database Design and DevelopmentIntroduction of Database Design and Development
Introduction of Database Design and Development
 
Relational database
Relational databaseRelational database
Relational database
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbms
 
Basic database analysis(database)
Basic database analysis(database)Basic database analysis(database)
Basic database analysis(database)
 
Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)
 
Object oriented database model
Object oriented database modelObject oriented database model
Object oriented database model
 
Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..
 
Ch 12 O O D B Dvlpt
Ch 12  O O  D B  DvlptCh 12  O O  D B  Dvlpt
Ch 12 O O D B Dvlpt
 
Class and object_diagram
Class  and object_diagramClass  and object_diagram
Class and object_diagram
 
Data modeling
Data modelingData modeling
Data modeling
 
Summary data modelling
Summary data modellingSummary data modelling
Summary data modelling
 
Chapter-3 Data Modeling using ER Model
Chapter-3 Data Modeling using ER ModelChapter-3 Data Modeling using ER Model
Chapter-3 Data Modeling using ER Model
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraints
 
Module 5 oodb systems semantic db systems
Module 5 oodb systems  semantic db systemsModule 5 oodb systems  semantic db systems
Module 5 oodb systems semantic db systems
 
Ooad ppt
Ooad pptOoad ppt
Ooad ppt
 
Ch 3 E R Model
Ch 3  E R  ModelCh 3  E R  Model
Ch 3 E R Model
 
Erd1
Erd1Erd1
Erd1
 

Semelhante a Introduction to Relational Database Management Systems

316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasex316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasexabhaysonone0
 
Lecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusLecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusemailharmeet
 
Intro to Relational Model
Intro to Relational ModelIntro to Relational Model
Intro to Relational ModelHazemWaheeb1
 
Relational Algebra and it's Operations pptx
Relational Algebra and it's Operations pptxRelational Algebra and it's Operations pptx
Relational Algebra and it's Operations pptxdanishriasat792
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 
2.1 Basics of Functions and Their Graphs
2.1 Basics of Functions and Their Graphs2.1 Basics of Functions and Their Graphs
2.1 Basics of Functions and Their Graphssmiller5
 
Database systems-Formal relational query languages
Database systems-Formal relational query languagesDatabase systems-Formal relational query languages
Database systems-Formal relational query languagesjamunaashok
 
Relational algebra calculus
Relational algebra  calculusRelational algebra  calculus
Relational algebra calculusVaibhav Kathuria
 
Chapter-6 Relational Algebra
Chapter-6 Relational AlgebraChapter-6 Relational Algebra
Chapter-6 Relational AlgebraKunal Anand
 
R Programming: Introduction to Vectors
R Programming: Introduction to VectorsR Programming: Introduction to Vectors
R Programming: Introduction to VectorsRsquared Academy
 
RelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdfRelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdf10GUPTASOUMYARAMPRAK
 
Unit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfUnit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfajajkhan16
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Prosanta Ghosh
 
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)Mukund Trivedi
 
E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)Mukund Trivedi
 
E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2Mukund Trivedi
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra OperationsShefa Idrees
 

Semelhante a Introduction to Relational Database Management Systems (20)

316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasex316_16SCCCS4_2020052505222431.pptdatabasex
316_16SCCCS4_2020052505222431.pptdatabasex
 
Lecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusLecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculus
 
Intro to Relational Model
Intro to Relational ModelIntro to Relational Model
Intro to Relational Model
 
Relational Algebra and it's Operations pptx
Relational Algebra and it's Operations pptxRelational Algebra and it's Operations pptx
Relational Algebra and it's Operations pptx
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
2.1 Basics of Functions and Their Graphs
2.1 Basics of Functions and Their Graphs2.1 Basics of Functions and Their Graphs
2.1 Basics of Functions and Their Graphs
 
Database systems-Formal relational query languages
Database systems-Formal relational query languagesDatabase systems-Formal relational query languages
Database systems-Formal relational query languages
 
Ch2
Ch2Ch2
Ch2
 
Relational algebra calculus
Relational algebra  calculusRelational algebra  calculus
Relational algebra calculus
 
Chapter-6 Relational Algebra
Chapter-6 Relational AlgebraChapter-6 Relational Algebra
Chapter-6 Relational Algebra
 
R Programming: Introduction to Vectors
R Programming: Introduction to VectorsR Programming: Introduction to Vectors
R Programming: Introduction to Vectors
 
2 rel-algebra
2 rel-algebra2 rel-algebra
2 rel-algebra
 
uniT 4 (1).pptx
uniT 4 (1).pptxuniT 4 (1).pptx
uniT 4 (1).pptx
 
RelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdfRelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdf
 
Unit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfUnit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdf
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
 
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)
 
E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)
 
E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra Operations
 

Mais de Adri Jovin

Adri Jovin J J - CV
Adri Jovin J J - CVAdri Jovin J J - CV
Adri Jovin J J - CVAdri Jovin
 
Introduction to Database Management Systems
Introduction to Database Management SystemsIntroduction to Database Management Systems
Introduction to Database Management SystemsAdri Jovin
 
Neural Networks
Neural NetworksNeural Networks
Neural NetworksAdri Jovin
 
Introduction to Genetic Algorithm
Introduction to Genetic AlgorithmIntroduction to Genetic Algorithm
Introduction to Genetic AlgorithmAdri Jovin
 
Introduction to Fuzzy logic
Introduction to Fuzzy logicIntroduction to Fuzzy logic
Introduction to Fuzzy logicAdri Jovin
 
Introduction to Artificial Neural Networks
Introduction to Artificial Neural NetworksIntroduction to Artificial Neural Networks
Introduction to Artificial Neural NetworksAdri Jovin
 
Introductory Session on Soft Computing
Introductory Session on Soft ComputingIntroductory Session on Soft Computing
Introductory Session on Soft ComputingAdri Jovin
 
Creative Commons
Creative CommonsCreative Commons
Creative CommonsAdri Jovin
 
Image based security
Image based securityImage based security
Image based securityAdri Jovin
 
Blockchain Technologies
Blockchain TechnologiesBlockchain Technologies
Blockchain TechnologiesAdri Jovin
 
Introduction to Cybersecurity
Introduction to CybersecurityIntroduction to Cybersecurity
Introduction to CybersecurityAdri Jovin
 
Advanced Encryption System & Block Cipher Modes of Operations
Advanced Encryption System & Block Cipher Modes of OperationsAdvanced Encryption System & Block Cipher Modes of Operations
Advanced Encryption System & Block Cipher Modes of OperationsAdri Jovin
 
Heartbleed Bug: A case study
Heartbleed Bug: A case studyHeartbleed Bug: A case study
Heartbleed Bug: A case studyAdri Jovin
 
Zoom: Privacy and Security - A case study
Zoom: Privacy and Security - A case studyZoom: Privacy and Security - A case study
Zoom: Privacy and Security - A case studyAdri Jovin
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve CryptographyAdri Jovin
 
El Gamal Cryptosystem
El Gamal CryptosystemEl Gamal Cryptosystem
El Gamal CryptosystemAdri Jovin
 
Data Encryption Standard
Data Encryption StandardData Encryption Standard
Data Encryption StandardAdri Jovin
 
Classical cryptographic techniques, Feistel cipher structure
Classical cryptographic techniques, Feistel cipher structureClassical cryptographic techniques, Feistel cipher structure
Classical cryptographic techniques, Feistel cipher structureAdri Jovin
 
Mathematical Foundations of Cryptography
Mathematical Foundations of CryptographyMathematical Foundations of Cryptography
Mathematical Foundations of CryptographyAdri Jovin
 
Security Models
Security ModelsSecurity Models
Security ModelsAdri Jovin
 

Mais de Adri Jovin (20)

Adri Jovin J J - CV
Adri Jovin J J - CVAdri Jovin J J - CV
Adri Jovin J J - CV
 
Introduction to Database Management Systems
Introduction to Database Management SystemsIntroduction to Database Management Systems
Introduction to Database Management Systems
 
Neural Networks
Neural NetworksNeural Networks
Neural Networks
 
Introduction to Genetic Algorithm
Introduction to Genetic AlgorithmIntroduction to Genetic Algorithm
Introduction to Genetic Algorithm
 
Introduction to Fuzzy logic
Introduction to Fuzzy logicIntroduction to Fuzzy logic
Introduction to Fuzzy logic
 
Introduction to Artificial Neural Networks
Introduction to Artificial Neural NetworksIntroduction to Artificial Neural Networks
Introduction to Artificial Neural Networks
 
Introductory Session on Soft Computing
Introductory Session on Soft ComputingIntroductory Session on Soft Computing
Introductory Session on Soft Computing
 
Creative Commons
Creative CommonsCreative Commons
Creative Commons
 
Image based security
Image based securityImage based security
Image based security
 
Blockchain Technologies
Blockchain TechnologiesBlockchain Technologies
Blockchain Technologies
 
Introduction to Cybersecurity
Introduction to CybersecurityIntroduction to Cybersecurity
Introduction to Cybersecurity
 
Advanced Encryption System & Block Cipher Modes of Operations
Advanced Encryption System & Block Cipher Modes of OperationsAdvanced Encryption System & Block Cipher Modes of Operations
Advanced Encryption System & Block Cipher Modes of Operations
 
Heartbleed Bug: A case study
Heartbleed Bug: A case studyHeartbleed Bug: A case study
Heartbleed Bug: A case study
 
Zoom: Privacy and Security - A case study
Zoom: Privacy and Security - A case studyZoom: Privacy and Security - A case study
Zoom: Privacy and Security - A case study
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
 
El Gamal Cryptosystem
El Gamal CryptosystemEl Gamal Cryptosystem
El Gamal Cryptosystem
 
Data Encryption Standard
Data Encryption StandardData Encryption Standard
Data Encryption Standard
 
Classical cryptographic techniques, Feistel cipher structure
Classical cryptographic techniques, Feistel cipher structureClassical cryptographic techniques, Feistel cipher structure
Classical cryptographic techniques, Feistel cipher structure
 
Mathematical Foundations of Cryptography
Mathematical Foundations of CryptographyMathematical Foundations of Cryptography
Mathematical Foundations of Cryptography
 
Security Models
Security ModelsSecurity Models
Security Models
 

Último

31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 

Último (20)

31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 

Introduction to Relational Database Management Systems

  • 1. Introduction to Relational Model Adri Jovin J J, M.Tech., Ph.D. UITG004- INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS
  • 2. Outline  Structure of Relational Databases  Database Schema  Keys  Schema Diagrams  Relational Query Languages  The Relational Algebra October 8, 2021 UITG004 2
  • 3. Example of a Instructor Relation attributes (or columns) tuples (or rows) 3
  • 4. Relation Schema and Instance  A1, A2, …, An are attributes  R = (A1, A2, …, An ) is a relation schema Example: instructor = (ID, name, dept_name, salary)  A relation instance r defined over schema R is denoted by r (R).  The current values a relation are specified by a table  An element t of relation r is called a tuple and is represented by a row in a table October 8, 2021 UITG004 4
  • 5. Attributes  The set of allowed values for each attribute is called the domain of the attribute  Attribute values are (normally) required to be atomic; that is, indivisible  The special value null is a member of every domain. Indicated that the value is “unknown”  The null value causes complications in the definition of many operations October 8, 2021 UITG004 5
  • 6. Relations are Unordered  Order of tuples is irrelevant (tuples may be stored in an arbitrary order)  Example: instructor relation with unordered tuples October 8, 2021 UITG004 6
  • 7. Database Schema  Database schema -- is the logical structure of the database.  Database instance -- is a snapshot of the data in the database at a given instant in time.  Example: • schema: instructor (ID, name, dept_name, salary) • Instance: October 8, 2021 UITG004 7
  • 8. Keys  Let K  R  K is a superkey of R if values for K are sufficient to identify a unique tuple of each possible relation r(R) • Example: {ID} and {ID,name} are both superkeys of instructor.  Superkey K is a candidate key if K is minimal Example: {ID} is a candidate key for Instructor  One of the candidate keys is selected to be the primary key. • Which one?  Foreign key constraint: Value in one relation must appear in another • Referencing relation • Referenced relation • Example: dept_name in instructor is a foreign key from instructor referencing department October 8, 2021 UITG004 8
  • 9. Schema Diagram for University Database 9
  • 10. Relational Query Languages  Procedural versus non-procedural, or declarative  “Pure” languages: • Relational algebra • Tuple relational calculus • Domain relational calculus  The above 3 pure languages are equivalent in computing power  We will concentrate in this chapter on relational algebra • Not Turing-machine equivalent • Consists of 6 basic operations October 8, 2021 UITG004 10
  • 11. Relational Algebra  A procedural language consisting of a set of operations that take one or two relations as input and produce a new relation as their result.  Six basic operators • select:  • project:  • union:  • set difference: – • Cartesian product: x • rename:  October 8, 2021 UITG004 11
  • 12. Select Operation  The select operation selects tuples that satisfy a given predicate.  Notation:  p (r)  p is called the selection predicate  Example: select those tuples of the instructor relation where the instructor is in the “Physics” department. • Query  dept_name=“Physics” (instructor) • Result October 8, 2021 UITG004 12
  • 13. Select Operation (Cont.)  We allow comparisons using =, , >, . <.  in the selection predicate.  We can combine several predicates into a larger predicate by using the connectives:  (and),  (or),  (not)  Example: Find the instructors in Physics with a salary greater $90,000, we write:  dept_name=“Physics”  salary > 90,000 (instructor)  The select predicate may include comparisons between two attributes. • Example, find all departments whose name is the same as their building name: •  dept_name=building (department) October 8, 2021 UITG004 13
  • 14. Project Operation  A unary operation that returns its argument relation, with certain attributes left out.  Notation:  A1,A2,A3 ….Ak (r) where A1, A2, …, Ak are attribute names and r is a relation name.  The result is defined as the relation of k columns obtained by erasing the columns that are not listed  Duplicate rows removed from result, since relations are sets October 8, 2021 UITG004 14
  • 15. Project Operation Example Example: eliminate the dept_name attribute of instructor Query: ID, name, salary (instructor) Result: October 8, 2021 UITG004 15
  • 16. Composition of Relational Operations  The result of a relational-algebra operation is relation and therefore of relational-algebra operations can be composed together into a relational-algebra expression.  Consider the query -- Find the names of all instructors in the Physics department. name( dept_name =“Physics” (instructor))  Instead of giving the name of a relation as the argument of the projection operation, we give an expression that evaluates to a relation. October 8, 2021 UITG004 16
  • 17. Cartesian-Product Operation  The Cartesian-product operation (denoted by X) allows us to combine information from any two relations.  Example: the Cartesian product of the relations instructor and teaches is written as: instructor X teaches  We construct a tuple of the result out of each possible pair of tuples: one from the instructor relation and one from the teaches relation  Since the instructor ID appears in both relations we distinguish between these attribute by attaching to the attribute the name of the relation from which the attribute originally came. • instructor.ID • teaches.ID October 8, 2021 UITG004 17
  • 18. The instructor X teaches table October 8, 2021 UITG004 18
  • 19. Join Operation  The Cartesian-Product instructor X teaches associates every tuple of instructor with every tuple of teaches. • Most of the resulting rows have information about instructors who did NOT teach a particular course.  To get only those tuples of “instructor X teaches “ that pertain to instructors and the courses that they taught, we write:  instructor.id = teaches.id (instructor x teaches )) We get only those tuples of “instructor X teaches” that pertain to instructors and the courses that they taught.  The result of this expression, shown in the next slide October 8, 2021 UITG004 19
  • 20. Join Operation (Cont.)  The table corresponding to:  instructor.id = teaches.id (instructor x teaches)) October 8, 2021 UITG004 20
  • 21. Join Operation (Cont.)  The join operation allows us to combine a select operation and a Cartesian-Product operation into a single operation.  Consider relations r (R) and s (S)  Let “theta” be a predicate on attributes in the schema R “union” S. The join operation r ⋈𝜃 s is defined as follows: 𝑟 ⋈𝜃 𝑠 = 𝜎𝜃 (𝑟 × 𝑠)  Thus  instructor.id = teaches.id (instructor x teaches ))  Can equivalently be written as instructor ⋈ Instructor.id = teaches.id teaches. October 8, 2021 UITG004 21
  • 22. Union Operation  The union operation allows us to combine two relations  Notation: r  s  For r  s to be valid. 1. r, s must have the same arity (same number of attributes) 2. The attribute domains must be compatible (example: 2nd column of r deals with the same type of values as does the 2nd column of s)  Example: to find all courses taught in the Fall 2017 semester, or in the Spring 2018 semester, or in both course_id ( semester=“Fall” Λ year=2017 (section))  course_id ( semester=“Spring” Λ year=2018 (section)) October 8, 2021 UITG004 22
  • 23. Union Operation (Cont.)  Result of: course_id ( semester=“Fall” Λ year=2017 (section))  course_id ( semester=“Spring” Λ year=2018 (section)) October 8, 2021 UITG004 23
  • 24. Set-Intersection Operation  The set-intersection operation allows us to find tuples that are in both the input relations.  Notation: r  s  Assume: • r, s have the same arity • attributes of r and s are compatible  Example: Find the set of all courses taught in both the Fall 2017 and the Spring 2018 semesters. course_id ( semester=“Fall” Λ year=2017 (section))  course_id ( semester=“Spring” Λ year=2018 (section)) • Result October 8, 2021 UITG004 24
  • 25. Set Difference Operation  The set-difference operation allows us to find tuples that are in one relation but are not in another.  Notation r – s  Set differences must be taken between compatible relations. • r and s must have the same arity • attribute domains of r and s must be compatible  Example: to find all courses taught in the Fall 2017 semester, but not in the Spring 2018 semester course_id ( semester=“Fall” Λ year=2017 (section)) − course_id ( semester=“Spring” Λ year=2018 (section)) October 8, 2021 UITG004 25
  • 26. The Assignment Operation  It is convenient at times to write a relational-algebra expression by assigning parts of it to temporary relation variables.  The assignment operation is denoted by  and works like assignment in a programming language.  Example: Find all instructor in the “Physics” and Music department. Physics   dept_name=“Physics” (instructor) Music   dept_name=“Music” (instructor) Physics  Music  With the assignment operation, a query can be written as a sequential program consisting of a series of assignments followed by an expression whose value is displayed as the result of the query. October 8, 2021 UITG004 26
  • 27. The Rename Operation  The results of relational-algebra expressions do not have a name that we can use to refer to them. The rename operator,  , is provided for that purpose  The expression: x (E) returns the result of expression E under the name x  Another form of the rename operation: x(A1,A2, .. An) (E) October 8, 2021 UITG004 27
  • 28. Equivalent Queries  There is more than one way to write a query in relational algebra.  Example: Find information about courses taught by instructors in the Physics department with salary greater than 90,000  Query 1  dept_name=“Physics”  salary > 90,000 (instructor)  Query 2  dept_name=“Physics” ( salary > 90.000 (instructor))  The two queries are not identical; they are, however, equivalent -- they give the same result on any database. October 8, 2021 UITG004 28
  • 29. Equivalent Queries  There is more than one way to write a query in relational algebra.  Example: Find information about courses taught by instructors in the Physics department  Query 1 dept_name=“Physics” (instructor ⋈ instructor.ID = teaches.ID teaches)  Query 2 (dept_name=“Physics” (instructor)) ⋈ instructor.ID = teaches.ID teaches  The two queries are not identical; they are, however, equivalent -- they give the same result on any database. October 8, 2021 UITG004 29
  • 30. References Abraham Silberschatz, Henry F. Korth & Sudharshan S (2010). Database System Concepts. 6th Edition, Tata McGraw Hill. Acknowledgement:  The content in this presentation is adopted from the website https://www.db-book.com/. This presentation is used for instructional purpose and not for any purpose involving monetary profits.  This presentation adheres to CC BY-SA 4.0, provided any user deriving the contents acknowledge the original authors Abraham Silberschatz, Henry F. Korth & Sudharshan S 30 October 8, 2021 UITG004