Page 176 - Artificial Intellegence_v2.0_Class_11
P. 176
Difference Operation
The difference operation removes common tuples from the first table. The set operation is denoted by ‘– ‘. The
expression (Student – Student 1) results is shown as:
Student Student 1
Rollno Name Marks Rollno Name Marks
100 Prakash 256 101 Vivek 256
102 Sudha 210 103 Punit 269
103 Punit 269 104 Kumar 287
105 Jimmy 210 106 John 276
106 John 276
Result of Difference Operation
Rollno Name Marks
100 Prakash 256
102 Sudha 210
105 Jimmy 210
Cartesian Product Operation
The cartesian product of two relations is the concatenation of tuples belonging to the two relations. The cartesian
product is a binary operation and is denoted by (x). Consider the two relations as given below:
Student Teacher
Rollno Name TNo. TName
101 Vivek
T01 Mr. Naveen
103 Punit T02 Mr. Govind
106 John
The cartesian product of the above two relations, Student x Teacher will produce the relation which has a degree (no.
of columns) of 4 (2+2) and a cardinality (no. of rows) of 6 (3 x 2).
Rollno Name TNo. TName
101 Vivek T01 Mr. Naveen
101 Vivek T02 Mr. Govind
103 Punit T01 Mr. Naveen
103 Punit T02 Mr. Govind
106 John T01 Mr. Naveen
106 John T02 Mr. Govind
Divide Operation
Divide operation is used when we have to evaluate queries that contain the keyword ‘all’. For example:
• “Which persons have a bank account at ALL the banks in the city?”
• “Which students are registered on ALL the courses given by Shiva University?”
• “Which students are registered on ALL the courses that are taught in period 2?”
174 Touchpad Artificial Intelligence (Ver. 2.0)-XI

