cs634 information systems dr deepak b phatak subrao nilekani chair professor kanwal rekhi building,...
TRANSCRIPT
![Page 1: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/1.jpg)
CS634 Information Systems
Dr Deepak B PhatakSubrao Nilekani Chair Professor
Kanwal Rekhi Building, Department of CSEIIT Bombay
Session 3, Relational Model
![Page 2: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/2.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 2
IIT BOMBAY
Session overview
• Review of earlier sessions• Introduction to relational model• Group projects
![Page 3: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/3.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 3
IIT BOMBAY
sroll
Entity model
Student
snameshostel
sroomscpi
scourses
shobbies
![Page 4: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/4.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 4
IIT BOMBAY
Table representation
sroll sname shostel
78011012 Ajay Shah 02
73815034 Nandan Nilekani 08
… … …
![Page 5: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/5.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 5
IIT BOMBAY
ccode
Course entity
Course
cname
cstudents
cfaculty
ccredits
![Page 6: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/6.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 6
IIT BOMBAY
TABLE REPRESENTATION
ccode cname ccredit
CS634 Modern Info Systems 06CS101 Computer Programming 08
…
……
![Page 7: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/7.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 7
IIT BOMBAY
Student and course association
Student Set Course Set
980140129801401599057943990579619910149199112345
CS634
CS101
ME203
EE102
![Page 8: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/8.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 8
IIT BOMBAY
Relationship set
Student
Registers For
Course
sroll
ccode
![Page 9: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/9.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 9
IIT BOMBAY
Relationship set attribute(s)
Student
Registers For
Course
sroll
ccode
Grade
![Page 10: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/10.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 10
IIT BOMBAY
Introduction to relational model
• Developed by professor Codd• Part of system-R work at IBM - 1972
• Mathematical foundation for database modeling
• Relational algebra and calculus• Structured Query Language (SQL)
• Structured English-like … (SEQUEL)
![Page 11: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/11.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 11
IIT BOMBAY
Relational model
• A relation is a set of n-tuples• Rows in a table
• Each relation has a schema• List of attributes• Similar to column headers in a table
![Page 12: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/12.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 12
IIT BOMBAY
Sample relation schema
• Student = (sroll, sname, sh, sr, scpi)• Course = (ccode, cname, ccredit)• Reg = (sroll, ccode, grade)
![Page 13: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/13.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 13
IIT BOMBAY
Student relation
Student Set Course Set
98014012 …98014015 …99057943 …99057961 …99101491 …99112345 …
Number of elements = no. of students
- Each element is a 5-tuple
![Page 14: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/14.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 14
IIT BOMBAY
Student relation as a Table
sroll sname sh
78011012 Ajay Shah 02
73815034 Nandan Nilekani 08
… … …
![Page 15: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/15.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 15
IIT BOMBAY
Relational algebra
• A relation is an element• Operators are defined over relation(s) • A relational operation results in a new
relation having• Different set of rows• Different schema (may be)• Or both
![Page 16: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/16.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 16
IIT BOMBAY
Keys
• Super key: A set of attributes that uniquely characterizes a specific n-tuple
• Candidate key: minimal super key• Primary key: chosen candidate key
![Page 17: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/17.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 17
IIT BOMBAY
Examples of keys
Student (sroll, sname, sh, sr, scpi)• Superkeys: (unique entity identifier)
Sroll; Sroll + sname;Sh + sr; Sroll + sh + sr; …
• Candidate keys are reduced minimal superkeys
Sroll; sh + sr (single occupancy assumption)
• Primary key: sroll (practical choice)
![Page 18: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/18.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 18
IIT BOMBAY
Sample relation
sroll sname sh
06011012 Vijay Ambre 02
sr scpi
218 8.49
06D15034 Parag Samarth
08 7.94218
06012015 Arul Menezes 03 146 9.25
06012018 Ajay Shah 03 151 8.38
06012014 Rajan Tambe 08 317 6.85
![Page 19: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/19.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 19
IIT BOMBAY
Sample relation
sroll sname sh
99011012 Vijay Ambre 02
sr
01D15034 Shaukat Ali 08
scpi
218 8.497.94218
98012015 Arul Menezes 03 146 9.2598012018 Ajay Shah 03 151 8.3898012014 Rajan Tambe 08 317 7.2598012019 Sanjay Mistry 07 169 6.85
![Page 20: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/20.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 20
IIT BOMBAY
Sample relation
sroll sname sh
99011012 Vijay Ambre 02
sr
01D15034 Shaukat Ali 08
scpi
218 8.497.94218
98012015 Arul Menezes 03 146 9.2598012018 Ajay Shah 03 151 8.3898012014 Rajan Tambe 08 317 7.2598012019 Sanjay Mistry 07 169 6.85
![Page 21: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/21.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 21
IIT BOMBAY
Relations
• If any value in a table (or a file) changes (add, delete, update), such a change can be made in the same table or file
• However, a relational operation results in a new relation
• Relational algebra operations are used to extract meaningful information from one or more relations
• Can be directly mapped into SQL
![Page 22: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/22.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 22
IIT BOMBAY
Relational algebra operators
• Selection• Get rows from a relation
• Projection• Get columns from a relation
• Cross product• Combine rows from multiple relations
• Join• Get meaningful information from the
cross product
![Page 23: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/23.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 23
IIT BOMBAY
Selection
• Extracts n-tuples from a relation R, based on a predicate (condition) P
• R1 = p (R)
• R1: has the same schema as that of R• P: valid condition on R
![Page 24: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/24.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 24
IIT BOMBAY
Selection
R1 = scpi > 9 AND sh = 3 (student)
The resulting relation will have one row [98012015 arul menezes 03 146 9.25]
SQL query for this relational operation can be written as
Select * From student Where scpi > 9 and sh = 3; ‘*’ means select ALL attributes of the schema
![Page 25: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/25.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 25
IIT BOMBAY
Projection
• Projects only specified attributes• Given as a list
• R1 = list (R)
• R1 has a new schema• Cardinality (no of rows) ?
![Page 26: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/26.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 26
IIT BOMBAY
Projection
R1 = cname, ccredit (course)
SQL query can be written as
Select cname, ccreditfrom Course;
cname ccreditInformation Systems 6Data Mining 6Professional Ethics in IT 3
![Page 27: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/27.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 27
IIT BOMBAY
Projection- another example
R1 = sh (student)
SQL query: Select sh From student;
How many elements would R1 have?
![Page 28: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/28.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 28
IIT BOMBAY
Projection example
sroll sname sh
99011012 Vijay Ambre 02
sr
01D15034 Shaukat Ali 08
scpi
218 8.497.94218
98012015 Arul menezes 03 146 9.2598012018 Ajay Shah 03 151 8.3898012014 Rajan Tambe 08 317 6.85
![Page 29: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/29.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 29
IIT BOMBAY
SQL implementation of projection
Select distinct sh From student;Result: Sh 2 8 3
![Page 30: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/30.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 30
IIT BOMBAY
Expressions
Sname ( scpi >9 & sh = 8 (student))
Select sname From student Where scpi > 9 And sh = 8;
![Page 31: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/31.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 31
IIT BOMBAY
CROSS PRODUCT
• Operates on two relations• R = R1 x R2• Concatenates each tuple of R1 with
every tuple of R2• If there are M and N elements in the
two relations, the resultant relation has M x N elements
• Schema of R is concatenation of the two schemas of R1 and R2• R1.A1, R1.A2, … , R2.A1, …, etc..
![Page 32: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/32.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 32
IIT BOMBAY
Example tables
sroll sname - -
89005012 Sunita Sarawagi - -
89007017 Kesav Nori - -
89004039 Muthukrishnan - -
- - - -
sroll ccode -
89005012 CS413 -
89005012 CS634 -
89007017 CS634 -
89007017 CS413 - 89004039 HS412 -
- - -
Student
Reg
![Page 33: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/33.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 33
IIT BOMBAY
Cross product
sroll sname --- --- Reg.sroll ccode -
89005012 Sunita Sarawagi - - 89005012 CS413 -89005012 Sunita Sarawagi - - 89005012 CS634 -
89005012 Sunita Sarawagi - - 89007017 CS634 -
89005012 Sunita Sarawagi - - 89007017 CS413 -
89005012 Sunita Sarawagi - - 89004039 HS412 -
89007017 Kesav Nori - - 89005012 CS413 -
89007017 Kesav Nori - - 89005012 CS634 -
89007017 Kesav Nori - - 89007017 CS634 -
Student X Reg(First 8 Rows)
![Page 34: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/34.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 34
IIT BOMBAY
Cross product
sroll sname --- --- sroll ccode -
89005012 Sunita Sarawagi - - 89005012 CS413 -89005012 Sunita Sarawagi - - 89005012 CS634 -
89005012 Sunita Sarawagi - - 89007017 CS634 -
89005012 Sunita Sarawagi - - 89007017 CS413 -
89005012 Sunita Sarawagi - - 89004039 HS412 -
89007017 Kesav Nori - - 89005012 CS413 -
89007017 Kesav Nori - - 89005012 CS634 -
89007017 Kesav Nori - - 89007017 CS634 -
Student X Reg(First 8 Rows)
![Page 35: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/35.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 35
IIT BOMBAY
Join
• Join is defined to get meaningful set of rows from a cross product
• R = ρ (R1 X R2)
• Selection predicate provides for meaningful information extraction
• Two categories of join• Natural join• Theta join
![Page 36: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/36.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 36
IIT BOMBAY
Natural join
• Ensures equality of values of all common attributes
• Result schema is union of two schemas
• R = r1 |x| r2
R = student |X| reg
R = student.Sroll =reg.Sroll (student X reg)
![Page 37: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/37.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 37
IIT BOMBAY
sroll sname --- --- sroll ccode
89005012 Sunita Sarawagi - - 89005012 CS413 89005012 Sunita Sarawagi - - 89005012 CS634
89005012 Sunita Sarawagi - - 89007017 CS634
89005012 Sunita Sarawagi - - 89007017 CS413
89005012 Sunita Sarawagi - - 89004039 HS412
89007017 Kesav Nori - - 89005012 CS413
89007017 Kesav Nori - - 89005012 CS634
89007017 Kesav Nori - - 89007017 CS634
Cross product Student X Reg(First 8 Rows)
![Page 38: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/38.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 38
IIT BOMBAY
SQL query for natural join
Select * from student natural join reg; Select * from student, reg Where student.Sroll = reg.Sroll;
![Page 39: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/39.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 39
IIT BOMBAY
Natural join schema
sroll sname --- --- sroll ccode
89005012 Sunita Sarawagi - - 89005012 CS413 -89005012 Sunita Sarawagi - - 89005012 IT640 -
89007017 Kesav Nori - - 89007017 IT640 -
89007017 Kesav Nori - - 89007017 CS413 -
89004039 Muthukrishnan - - 89004039 HS412 -
Student |X| Reg
![Page 40: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/40.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 40
IIT BOMBAY
Theta join
• R = R1 |x| R2
• Theta is any (meaningful) predicate• Usually has a “join” condition
• R = (R1 x R2)
• R = student |x| reg : student.sroll = reg.sroll and scpi > 9 and sh = 8
![Page 41: CS634 Information Systems Dr Deepak B Phatak Subrao Nilekani Chair Professor Kanwal Rekhi Building, Department of CSE IIT Bombay Session 3, Relational](https://reader037.vdocument.in/reader037/viewer/2022110321/56649f495503460f94c6b76f/html5/thumbnails/41.jpg)
CS634-Session 3 Relational ModelDr. Deepak B Phatak 41
IIT BOMBAY
SQL query for join
Select * from student, reg Where Student.Sroll = reg.Sroll and scpi > 9 and sh = 8;