Cartesian Product and Rename concept in Relational Database.

Cartesian Product: 

It is a binary operator which takes two relation r and s and it is denoted as  r X s , in Cartesian Product the output will consists of every possible combinations of tuples in r and s i.e each tuple in r will multiply with every tuple in s .

Example: 
Find out the Cartesian Product of the tables salesrep and orders.

salesrep X orders;


Consider  two relations as employee and department :
Table:Department
Table: Employee
Table : Employee X Department

Example:
Write an expression to find out all the employees with their name, sales, quota, order_date, amount if  they have sales < 50% of their quota.

SELECT name, sales, quota, order_date, amount 
FROM salesrep, Orders
WHERE rep= emp_id and sales < 0.5 * quota;

∏                             (σsales < 0.5 * quota(σrep = emp_id (salesrep X orders)))
    name, sales, quota, order_date, 

RENAME:

It is the unary operator that is it takes one relation say  r and it is denoted as:
ρ  (r) 
   x
where  r will be renamed as x.

Comments

Popular posts from this blog

Introduction to Python.

Decision Making Statement.