SlideShare a Scribd company logo
1
 A person, place, event or item is called an entity
 The facts describing an entity are known as data
 Each entity can be described by its characteristics
known as attributes
 All the related entities are collected together to
form an entity set
 A database is a collection of entity sets
 The interaction between the entity sets are called
relationships.
2
 A data base is an electronic store of data.
 It stores information about different “things”& also
contains relationships.
 The collection of data may be organized in the
form of files or tables.
Examples:-
1. Oracle 9i, 10G, 10Gi, 11G, 11Gi
2. SQL-server-2005, 2010
3. DB2,Sybase,foxpro, Ms-access2003,2007, 2010,
3
 A DBMS is a software package designed to define,
manipulate, retrieve and manage data in a database.
 It also defines rules to validate and manipulate the
data.
 It relieves users of framing programs for data
maintenance.
 Fourth-generation query languages, such as SQL, are
used along with the DBMS package to interact with a
database.
4
1. Banking Sector
2. Universities
3. Railway Reservation
4. Finance
5. Sales
5
1. One-to-one (1:1) :
Each entity has only one matching entity in another
entity set
Eg: Student (1) – RollNo. (1)
2. One-to-many (1:M):
Each entity of X has many matching entities in
another entity set Y.
Eg: Department (1) – Employees (M)
3. Many-to-many (M:M):
Each entity of X has many matching entities in
another entity set Y and vice versa.
Eg: Students (M) – Courses (M)
6
 DBMS S/W Packages – MS Access, Oracle
 User developed & implemented DB
 Custom Applications such as forms,Reports,query
blocks
 Computer hardware – PCs, minicomputers
 Software – OS and Network OS
 Personnel- DB administrator, designer
7
User
Applications DBMS Database
OS Software
Hardware
8
 RDBMS is a DBMS i.e. based on Relational model as
introduce by Dr. E.F. Codd…..
 Codd’s rule for RDBMS:-
 Dr. Codd is an IBM researcher who developed
relational data base in 1970…..
In 1905 Codd published 12 rules……
1)The Information rule.
2)Granted access rule.
3)Systemic treatment of NULL values.
4)Dynamic online Catalog based on relational model.
9
5)Comprehensive data sub-language rule.
6)View updating rule.
7)High level Insert , Update, Delete rule.
8)Physical data Independence.
9)Logical data Independence.
10)Integrity data Independence.
11)Distribution data Independence.
12)Non-subversions rule.
10
1. It manages the data and relationships stored
in the database.
2. It creates a Data Dictionary (DD) as a user
creates a DB. DD stores Metadata (data
about data)
3. Manages all day-to-day transactions
4. Data search can be done through DD
5. User can validate data
11
6. Secures access through passwords, encryption
etc..
7. Backup & Recovery procedures
8. Data Sharing with data-locking capabilities
9. Import and Export Utilities from other databases
10. Users can view information stored in different
tables within the database.
12
13
 E.F.Codd developed the relational model in 1970.
 The relation is represented by a table structure
 Each row represents an entity
 Each column represents an attribute
 DATA STRUCTURES - domain, attribute, relation,
tuple, primary key, degree, cardinality.
 INTEGRITY CONSTRAINTS - entity integrity and
referential integrity.
 DATA MANIPULATION OPERATIONS - defined
through relational algebra and equivalent relational
calculus.
14
 A database consists of one or more relations.
 A relation is described by a name, names for one
or more attributes and consists of zero or more
tuples.
 A tuple consists of values for each attribute of the
relation.
 An attribute takes values from a domain and
there exists one value for each attribute in a tuple.
 A domain consists of all allowed atomic values for
one or more attributes.
 Degree of a relation is the number of attributes of
the relation.
 Cardinality of a relation is the number of tuples of
the relation.
15
16
17
18
 Keys are very important part of Relational
database.
 They are used to establish and identify relation
between tables.
 They also ensure that each record within a table
can be uniquely identified by combination of one
or more fields within a table.
19
Super Key:
 Super Key is defined as a set of attributes within
a table that uniquely identifies each record within a
table.
 Super Key is a superset of Candidate key.
Candidate Key:
 Candidate keys are defined as the set of fields
from which primary key can be selected.
 It is an attribute or set of attributes that can act as
a primary key for a table to uniquely identify each
record in that table.
20
21
 The minimal set of attribute which can uniquely identify a tuple is
known as candidate key.
 For Example, STUD_NO in STUDENT relation.
 The value of Candidate Key is unique and non-null for every tuple.
 There can be more than one candidate key in a relation.
 For Example, STUD_NO as well as STUD_PHONE both are
candidate keys for relation STUDENT.
 The candidate key can be simple (having only one attribute) or
composite as well.
 For Example, {STUD_NO, COURSE_NO} is a composite candidate
key for relation STUDENT_COURSE.
22
 The set of attributes which can uniquely identify a
tuple is known as Super Key.
 For Example, STUD_NO, (STUD_NO,
STUD_NAME) etc.
 Adding zero or more attributes to candidate key
generates super key.
 A candidate key is a super key but vice versa is
not true
23
 There can be more than one candidate key in a
relation out of which one can be chosen as
primary key( that is most appropriate to become
main key of the table)
 For Example, STUD_NO as well as
STUD_PHONE both are candidate keys for
relation STUDENT but STUD_NO can be chosen
as primary key (only one out of many candidate
keys).
24
 The candidate key other than primary key is called
as alternate key.
 For Example, STUD_NO as well as
STUD_PHONE both are candidate keys for
relation STUDENT but STUD_PHONE will be
alternate key (only one out of many candidate
keys).
25
 If we use multiple attributes to create a Primary
Key then that Primary Key is called Composite
Key (also called a Compound Key or
Concatenated Key).
26
 A foreign key is an attribute or combination of attributes
in one base table that points to the candidate key
(generally it is the primary key) of another table.
 The purpose of the foreign key is to ensure referential
integrity of the data
 For Example, STUD_NO in STUDENT_COURSE is a
foreign key to STUD_NO in STUDENT relation.
27
It is very important that data in the underlying tables be
consistent
Two integrity rules:
1. Entity Integrity (feature of primary key)
◦ No column in primary key may be null
◦ Primary key provides the means of uniquely identifying a row or
an entity.
◦ A null value means a value that is not known, not entered, not
defined or not applicable.
28
◦ A zero or space is not considered to be a null
value
◦ RDBMS does not allow users to enter a row
without a unique value in the primary key column
2. Referential Integrity(feature of foreign key)
◦ Foreign key value may be null or it must exist as a value
of a primary key in the referenced table.
◦ Oracle does not allow to declare a foreign key if it does
not exist as a primary key in another table
29
 Relational algebra , a procedural language
 Relational calculus, a non-procedural language
30
31
 Relational algebra is a collection of operations to
manipulate or access tables
 It is a procedural language with operations
performed on one or more existing relations to
derive resulting operations without changing the
original relations.
 The operations can be divided into two groups
 SET-ORIENTED OPERATIONS
 NATIVE(SPECIAL)RELATIONAL
OPERATIONS.
Basics of Relational
Algebra
32
BASIC SET ORIENTED OPERATIONS
NAME SYMBOL
UNION U
INTERSECTION ∩
DIFFERENCE -
PRODUCT ×
NATIVE RELATIONAL OPERATIONS
NAME SYMBOL
SELECTION σ
PROJECTION Π
JOIN
DIVISION ÷
ASSIGNMENT 
33
UNION
ROLL.NO NAME
12505 SHARAN
12506 SANGEETA
12507 SHYNA
A
B
ROLL.NO NAME
12502 PRABJOT
125O7 SHYNA
12520 POOJA
12521 RINKI
ROLL.NO NAME
12502 PRABJOT
12505 SHARAN
12506 SANGEETA
12507 SHYNA
12520 POOJA
12521 RINKI
R=AUB
34
INTERSECTION
ROLL.NO NAME
12502 PRABJOT
12505 SHARAN
12507 SHYNA
12521 RINKI
ROLL.NO NAME
12507 SHYNA
12519 POOJA
12521 RINKI
A
B
R=A∩B
ROLL.NO NAME
12507 SHYNA
12521 RINKI
35
DIFFERENCE
B
A
ROLL.NO NAME
12502 PRABJOT
12505 SHARAN
12507 SHYNA
12521 RINKI
ROLL.NO NAME
12507 SHYNA
12519 POOJA
12514 NEETU
12521 RINKI
R=A-B
ROLL.NO NAME
12502 PRABJOT
12505 SHARAN
R=B-A
ROLL.NO NAME
12519 POOJA
12514 NEETU
36
CARTESIAN PRODUCT
ROLL.NO NAME
12502 PRABJOT
12505 SHARAN
12507 SHYNA
12521 RINKI
A
ROLL.NO NAME
12507 SHYNA
12519 POOJA
B
R=A×B
ROLL.NO NAME ROLL.NO NAME
12502 PRABJOT 12507 SHYNA
12502 PRABJOT 12519 POOJA
12505 SHARAN 12507 SHYNA
12505 SHARAN 12519 POOJA
12507 SHYNA 12507 SHYNA
12507 SHYNA 12519 POOJA
12521 RINKI 12507 SHYNA
12521 RINKI 12521 POOJA
37
ID NAME SALARY AGE
101 AMIT 4500 30
102 AJAY 5000 35
105 JOHN 5000 36
106 ABHI 4000 28
107 ALI 4800 31
108 SUNIL 3500 33
EMPLOYEE
SELECTION
RESULTING TABLE
σAGE >32 (EMPLOYEE)
ID NAME SALARY AGE
102 AJAY 5000 35
105 JOHN 5000 36
108 SUNIL 3500 33
38
PROJECTION
EMPLOYEE
ID NAME SALARY AGE
101 AMIT 4500 30
102 AJAY 5000 35
105 JOHN 5000 36
106 ABHI 4000 28
107 ALI 4800 31
108 SUNIL 3500 33
109 JOHN 4600 29
RESULTING TABLES
A. π ID (EMPLOYEE)
B. π NAME,AGE (EMPLOYEE)
NAME AGE
AMIT 30
AJAY 35
JOHN 36
ABHI 28
ALI 31
SUNIL 33
JOHN 29
ID
101
102
105
106
107
108
109
B
A
39
COURSE(C)
ROLL.NO NAME COURSE
101 PIYUSH M-01
102 SUMIT M-02
103 SHEENA M-04
104 RITU M-03
S
JOIN
C_ID C_NAME C_DUR
M-01 MBA(HR) 2
M-02 MSC(PHY) 2
M-03 MSC(IT) 2
M-04 MCA 3
ROLL.NO NAME COURSE
101 PIYUSH M-01
102 SUMIT M-02
103 SHEENA M-04
104 RITU M-03
C_ID C_NAME C_DUR
M-01 MBA(HR) 2
M-02 MSC(PHY) 2
M-04 MCA 3
M-03 MSC(IT) 2
RESULTING TABLE(EQUI-JOIN)
COURSE=C_ID (C)
STU(S)
40
ROLL.NO NAME COURSE
101 PIYUSH M-01
102 SUMIT M-02
103 SHEENA M-04
104 RITU M-03
C_NAME C_DUR
MBA(HR) 2
MSC(PHY) 2
MCA 3
MSC(IT) 2
COURSE(C)
ROLL.NO NAME COURSE
101 PIYUSH M-01
102 SUMIT M-02
103 SHEENA M-04
104 RITU M-03
C_ID C_NAME C_DUR
M-01 MBA(HR) 2
M-02 MSC(PHY) 2
M-03 MSC(IT) 2
M-04 MCA 3
NATURAL JOIN ON S AND C
NATURAL JOIN(INNER JOIN)
STU(S)
41
DIVISION
NAME COUR
SE
A1 B1
A3 B2
A2 B3
A2 B1
A1 B3
A3 B3
A3 B1
COURSE
B1
B3
COURS
E
B2
COURSE
B2
B3
MAIN
R1
SUB2 SUB3
RESULTING TABLES
R3
R3MAIN÷SUB3
R2
NAME
A1
A2
A3
NAME
A3
NAME
A3
R1MAIN ÷ SUB1
R2MAIN÷SUB2
SUB1
ASSIGNMENT
Eg: Student enrolled in
ALL the courses
 Non Procedural
 Programmer specifies data requirement
 General Syntax:
result=(column list):expression
 Example:
r.Name:r in Employee and r.age<30
 Result:
42
Name
ABHI
JOHN

More Related Content

PPTX
Database Concepts.pptx
DOCX
COMPUTERS Database
PPTX
DBMS-Unit-2.pptx
PPTX
PPTX
DEE 431 Database keys and Normalisation Slide 2
PPTX
PPT
Database Technology Teaching Material For Learn
PDF
Relational Database Model Database Management system
Database Concepts.pptx
COMPUTERS Database
DBMS-Unit-2.pptx
DEE 431 Database keys and Normalisation Slide 2
Database Technology Teaching Material For Learn
Relational Database Model Database Management system

Similar to NMEC RD_UNIT 1.ppt (20)

PPTX
Relational Database Management System part II
DOCX
RELATIONAL DATABASE PURPOSE OF DATABASE SYSTEM
PPTX
codd rules of dbms given by E F codd who is called father of dbms
PPTX
Fundamentals of database system - Relational data model and relational datab...
PPTX
Codds rules & keys
PPTX
Unit 2 DBMS.pptx
PDF
PDF
Dbms interview questions
PDF
Chapter 2 Database System Architecture.pdf
PPTX
Relational model
PDF
Understanding about relational database m-square systems inc
DOCX
Dbms interview ques
PDF
DBMS and Rdbms fundamental concepts
PDF
Dbms 9: Relational Model
PDF
Unit_2.pdf
PPTX
UNIT2-Reference ppt..pptx which weil; be leading tpo the undrsdtanding od thr...
PPT
RDBMS_Concept.ppt
PPTX
Relational Model in DBMS detail explanation
PPTX
2. Relational_Data_Model_Keys_10b.pptx
PPTX
Chapter-5 The Relational Data Model
Relational Database Management System part II
RELATIONAL DATABASE PURPOSE OF DATABASE SYSTEM
codd rules of dbms given by E F codd who is called father of dbms
Fundamentals of database system - Relational data model and relational datab...
Codds rules & keys
Unit 2 DBMS.pptx
Dbms interview questions
Chapter 2 Database System Architecture.pdf
Relational model
Understanding about relational database m-square systems inc
Dbms interview ques
DBMS and Rdbms fundamental concepts
Dbms 9: Relational Model
Unit_2.pdf
UNIT2-Reference ppt..pptx which weil; be leading tpo the undrsdtanding od thr...
RDBMS_Concept.ppt
Relational Model in DBMS detail explanation
2. Relational_Data_Model_Keys_10b.pptx
Chapter-5 The Relational Data Model
Ad

Recently uploaded (20)

PPTX
Transform Your Business with a Software ERP System
PDF
AI in Product Development-omnex systems
PPTX
history of c programming in notes for students .pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
System and Network Administraation Chapter 3
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPT
Introduction Database Management System for Course Database
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Transform Your Business with a Software ERP System
AI in Product Development-omnex systems
history of c programming in notes for students .pptx
Operating system designcfffgfgggggggvggggggggg
Odoo POS Development Services by CandidRoot Solutions
CHAPTER 2 - PM Management and IT Context
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Wondershare Filmora 15 Crack With Activation Key [2025
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
System and Network Administraation Chapter 3
How Creative Agencies Leverage Project Management Software.pdf
Design an Analysis of Algorithms I-SECS-1021-03
Understanding Forklifts - TECH EHS Solution
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
2025 Textile ERP Trends: SAP, Odoo & Oracle
Which alternative to Crystal Reports is best for small or large businesses.pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Introduction Database Management System for Course Database
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Ad

NMEC RD_UNIT 1.ppt

  • 1. 1
  • 2.  A person, place, event or item is called an entity  The facts describing an entity are known as data  Each entity can be described by its characteristics known as attributes  All the related entities are collected together to form an entity set  A database is a collection of entity sets  The interaction between the entity sets are called relationships. 2
  • 3.  A data base is an electronic store of data.  It stores information about different “things”& also contains relationships.  The collection of data may be organized in the form of files or tables. Examples:- 1. Oracle 9i, 10G, 10Gi, 11G, 11Gi 2. SQL-server-2005, 2010 3. DB2,Sybase,foxpro, Ms-access2003,2007, 2010, 3
  • 4.  A DBMS is a software package designed to define, manipulate, retrieve and manage data in a database.  It also defines rules to validate and manipulate the data.  It relieves users of framing programs for data maintenance.  Fourth-generation query languages, such as SQL, are used along with the DBMS package to interact with a database. 4
  • 5. 1. Banking Sector 2. Universities 3. Railway Reservation 4. Finance 5. Sales 5
  • 6. 1. One-to-one (1:1) : Each entity has only one matching entity in another entity set Eg: Student (1) – RollNo. (1) 2. One-to-many (1:M): Each entity of X has many matching entities in another entity set Y. Eg: Department (1) – Employees (M) 3. Many-to-many (M:M): Each entity of X has many matching entities in another entity set Y and vice versa. Eg: Students (M) – Courses (M) 6
  • 7.  DBMS S/W Packages – MS Access, Oracle  User developed & implemented DB  Custom Applications such as forms,Reports,query blocks  Computer hardware – PCs, minicomputers  Software – OS and Network OS  Personnel- DB administrator, designer 7
  • 9.  RDBMS is a DBMS i.e. based on Relational model as introduce by Dr. E.F. Codd…..  Codd’s rule for RDBMS:-  Dr. Codd is an IBM researcher who developed relational data base in 1970….. In 1905 Codd published 12 rules…… 1)The Information rule. 2)Granted access rule. 3)Systemic treatment of NULL values. 4)Dynamic online Catalog based on relational model. 9
  • 10. 5)Comprehensive data sub-language rule. 6)View updating rule. 7)High level Insert , Update, Delete rule. 8)Physical data Independence. 9)Logical data Independence. 10)Integrity data Independence. 11)Distribution data Independence. 12)Non-subversions rule. 10
  • 11. 1. It manages the data and relationships stored in the database. 2. It creates a Data Dictionary (DD) as a user creates a DB. DD stores Metadata (data about data) 3. Manages all day-to-day transactions 4. Data search can be done through DD 5. User can validate data 11
  • 12. 6. Secures access through passwords, encryption etc.. 7. Backup & Recovery procedures 8. Data Sharing with data-locking capabilities 9. Import and Export Utilities from other databases 10. Users can view information stored in different tables within the database. 12
  • 13. 13
  • 14.  E.F.Codd developed the relational model in 1970.  The relation is represented by a table structure  Each row represents an entity  Each column represents an attribute  DATA STRUCTURES - domain, attribute, relation, tuple, primary key, degree, cardinality.  INTEGRITY CONSTRAINTS - entity integrity and referential integrity.  DATA MANIPULATION OPERATIONS - defined through relational algebra and equivalent relational calculus. 14
  • 15.  A database consists of one or more relations.  A relation is described by a name, names for one or more attributes and consists of zero or more tuples.  A tuple consists of values for each attribute of the relation.  An attribute takes values from a domain and there exists one value for each attribute in a tuple.  A domain consists of all allowed atomic values for one or more attributes.  Degree of a relation is the number of attributes of the relation.  Cardinality of a relation is the number of tuples of the relation. 15
  • 16. 16
  • 17. 17
  • 18. 18
  • 19.  Keys are very important part of Relational database.  They are used to establish and identify relation between tables.  They also ensure that each record within a table can be uniquely identified by combination of one or more fields within a table. 19
  • 20. Super Key:  Super Key is defined as a set of attributes within a table that uniquely identifies each record within a table.  Super Key is a superset of Candidate key. Candidate Key:  Candidate keys are defined as the set of fields from which primary key can be selected.  It is an attribute or set of attributes that can act as a primary key for a table to uniquely identify each record in that table. 20
  • 21. 21
  • 22.  The minimal set of attribute which can uniquely identify a tuple is known as candidate key.  For Example, STUD_NO in STUDENT relation.  The value of Candidate Key is unique and non-null for every tuple.  There can be more than one candidate key in a relation.  For Example, STUD_NO as well as STUD_PHONE both are candidate keys for relation STUDENT.  The candidate key can be simple (having only one attribute) or composite as well.  For Example, {STUD_NO, COURSE_NO} is a composite candidate key for relation STUDENT_COURSE. 22
  • 23.  The set of attributes which can uniquely identify a tuple is known as Super Key.  For Example, STUD_NO, (STUD_NO, STUD_NAME) etc.  Adding zero or more attributes to candidate key generates super key.  A candidate key is a super key but vice versa is not true 23
  • 24.  There can be more than one candidate key in a relation out of which one can be chosen as primary key( that is most appropriate to become main key of the table)  For Example, STUD_NO as well as STUD_PHONE both are candidate keys for relation STUDENT but STUD_NO can be chosen as primary key (only one out of many candidate keys). 24
  • 25.  The candidate key other than primary key is called as alternate key.  For Example, STUD_NO as well as STUD_PHONE both are candidate keys for relation STUDENT but STUD_PHONE will be alternate key (only one out of many candidate keys). 25
  • 26.  If we use multiple attributes to create a Primary Key then that Primary Key is called Composite Key (also called a Compound Key or Concatenated Key). 26
  • 27.  A foreign key is an attribute or combination of attributes in one base table that points to the candidate key (generally it is the primary key) of another table.  The purpose of the foreign key is to ensure referential integrity of the data  For Example, STUD_NO in STUDENT_COURSE is a foreign key to STUD_NO in STUDENT relation. 27
  • 28. It is very important that data in the underlying tables be consistent Two integrity rules: 1. Entity Integrity (feature of primary key) ◦ No column in primary key may be null ◦ Primary key provides the means of uniquely identifying a row or an entity. ◦ A null value means a value that is not known, not entered, not defined or not applicable. 28
  • 29. ◦ A zero or space is not considered to be a null value ◦ RDBMS does not allow users to enter a row without a unique value in the primary key column 2. Referential Integrity(feature of foreign key) ◦ Foreign key value may be null or it must exist as a value of a primary key in the referenced table. ◦ Oracle does not allow to declare a foreign key if it does not exist as a primary key in another table 29
  • 30.  Relational algebra , a procedural language  Relational calculus, a non-procedural language 30
  • 31. 31  Relational algebra is a collection of operations to manipulate or access tables  It is a procedural language with operations performed on one or more existing relations to derive resulting operations without changing the original relations.  The operations can be divided into two groups  SET-ORIENTED OPERATIONS  NATIVE(SPECIAL)RELATIONAL OPERATIONS. Basics of Relational Algebra
  • 32. 32 BASIC SET ORIENTED OPERATIONS NAME SYMBOL UNION U INTERSECTION ∩ DIFFERENCE - PRODUCT × NATIVE RELATIONAL OPERATIONS NAME SYMBOL SELECTION σ PROJECTION Π JOIN DIVISION ÷ ASSIGNMENT 
  • 33. 33 UNION ROLL.NO NAME 12505 SHARAN 12506 SANGEETA 12507 SHYNA A B ROLL.NO NAME 12502 PRABJOT 125O7 SHYNA 12520 POOJA 12521 RINKI ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12506 SANGEETA 12507 SHYNA 12520 POOJA 12521 RINKI R=AUB
  • 34. 34 INTERSECTION ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12507 SHYNA 12521 RINKI ROLL.NO NAME 12507 SHYNA 12519 POOJA 12521 RINKI A B R=A∩B ROLL.NO NAME 12507 SHYNA 12521 RINKI
  • 35. 35 DIFFERENCE B A ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12507 SHYNA 12521 RINKI ROLL.NO NAME 12507 SHYNA 12519 POOJA 12514 NEETU 12521 RINKI R=A-B ROLL.NO NAME 12502 PRABJOT 12505 SHARAN R=B-A ROLL.NO NAME 12519 POOJA 12514 NEETU
  • 36. 36 CARTESIAN PRODUCT ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12507 SHYNA 12521 RINKI A ROLL.NO NAME 12507 SHYNA 12519 POOJA B R=A×B ROLL.NO NAME ROLL.NO NAME 12502 PRABJOT 12507 SHYNA 12502 PRABJOT 12519 POOJA 12505 SHARAN 12507 SHYNA 12505 SHARAN 12519 POOJA 12507 SHYNA 12507 SHYNA 12507 SHYNA 12519 POOJA 12521 RINKI 12507 SHYNA 12521 RINKI 12521 POOJA
  • 37. 37 ID NAME SALARY AGE 101 AMIT 4500 30 102 AJAY 5000 35 105 JOHN 5000 36 106 ABHI 4000 28 107 ALI 4800 31 108 SUNIL 3500 33 EMPLOYEE SELECTION RESULTING TABLE σAGE >32 (EMPLOYEE) ID NAME SALARY AGE 102 AJAY 5000 35 105 JOHN 5000 36 108 SUNIL 3500 33
  • 38. 38 PROJECTION EMPLOYEE ID NAME SALARY AGE 101 AMIT 4500 30 102 AJAY 5000 35 105 JOHN 5000 36 106 ABHI 4000 28 107 ALI 4800 31 108 SUNIL 3500 33 109 JOHN 4600 29 RESULTING TABLES A. π ID (EMPLOYEE) B. π NAME,AGE (EMPLOYEE) NAME AGE AMIT 30 AJAY 35 JOHN 36 ABHI 28 ALI 31 SUNIL 33 JOHN 29 ID 101 102 105 106 107 108 109 B A
  • 39. 39 COURSE(C) ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 S JOIN C_ID C_NAME C_DUR M-01 MBA(HR) 2 M-02 MSC(PHY) 2 M-03 MSC(IT) 2 M-04 MCA 3 ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_ID C_NAME C_DUR M-01 MBA(HR) 2 M-02 MSC(PHY) 2 M-04 MCA 3 M-03 MSC(IT) 2 RESULTING TABLE(EQUI-JOIN) COURSE=C_ID (C) STU(S)
  • 40. 40 ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_NAME C_DUR MBA(HR) 2 MSC(PHY) 2 MCA 3 MSC(IT) 2 COURSE(C) ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_ID C_NAME C_DUR M-01 MBA(HR) 2 M-02 MSC(PHY) 2 M-03 MSC(IT) 2 M-04 MCA 3 NATURAL JOIN ON S AND C NATURAL JOIN(INNER JOIN) STU(S)
  • 41. 41 DIVISION NAME COUR SE A1 B1 A3 B2 A2 B3 A2 B1 A1 B3 A3 B3 A3 B1 COURSE B1 B3 COURS E B2 COURSE B2 B3 MAIN R1 SUB2 SUB3 RESULTING TABLES R3 R3MAIN÷SUB3 R2 NAME A1 A2 A3 NAME A3 NAME A3 R1MAIN ÷ SUB1 R2MAIN÷SUB2 SUB1 ASSIGNMENT Eg: Student enrolled in ALL the courses
  • 42.  Non Procedural  Programmer specifies data requirement  General Syntax: result=(column list):expression  Example: r.Name:r in Employee and r.age<30  Result: 42 Name ABHI JOHN