Page 135 - Touhpad Ai
P. 135
Set Intersection
The intersection of sets A and B is the set of elements that are common in A and B. It is
A B denoted by A B. For example:
If A = {21, 22, 23} and B = {23, 24, 25}, then A B = {23}.
Set Difference
The difference between two sets is the set containing elements that are in A but not in B.
It is denoted by A – B. For example: A B
A = {21, 22, 23, 24, 25} and B = {22, 24, 26, 28}, then A – B = {21, 23, 25}.
Complement of a Set A – B
The complement of a set A (denoted by A′) is the set of elements that are not in set A. A′ = (U - A) where U is a universal
set that contains all objects. For example:
Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9} and A = {2, 4, 6, 8}
Then A′ = {1, 3, 5, 7, 9}.
Cartesian Product
A B
The Cartesian product of two sets A and B, denoted by A × B, is the set of all ordered
1
a pairs where the first element is in A and the second element is in B. For example:
2
b A = {1, 2, 3} and B = {2, 3}
3 Then A × B = {(1, 2), (1, 3), (2, 2), (2, 3), (3, 2), (3, 3)}.
Set theory was created in 1874 by the German Mathematician Georg Cantor.
BRAINY Cantor defined infinite and well-ordered sets and proved that there are more real
FACT
numbers than natural numbers.
Introduction to Data Table Joins
You must have noted by now that relational databases are based almost entirely upon set theory. Let us now study
joins. A JOIN is used to combine rows from two or more tables, based on a related/common column between them.
Joining tables is essentially a Cartesian product followed by a selection criterion.
Different Types of Joins
There are 4 types of joins:
Inner Join
When INNER JOIN keyword is used, those records are selected that have matching values
in both the tables. In an inner join, only those tuples that satisfy the matching condition Left Right
are included, while the remaining tuples are excluded. Table Table
Syntax: SELECT table1.column1, table1.column2, table2.column1, .....
FROM table1
INNER JOIN table2
ON table1.matching_column = table2.matching_column;
where table1: First table, table2: Second table and matching_column: Column common to both the tables.
Mathematics for AI 133

