Analysis and Design of Data Systems. Relational Algebra 2 (Lecture 18) презентация

A B A B A B UNION MINUS INTERSECTION Set

Слайд 1IE301 Analysis and Design of Data Systems Lecture 18
Relational Algebra 2
Aram Keryan

November

16, 2015


Слайд 2A B
A

B

A B

UNION

MINUS

INTERSECTION




Set Operations UNION, INTERSECTION, MINUS

The next group of relational algebra operations are the standard mathematical operations on sets.


Слайд 3Set Operations UNION, INTERSECTION, MINUS
UNION, INTERSECTION, and MINUS are binary operations.
 
This means

that the two relations have the same number of attributes and each corresponding pair of attributes has the same domain.

Слайд 4UNION
Example: Retrieve the Social Security numbers of all employees who either

work in department 5 or directly supervise an employee who works in department 5.

Step 1:

Step 2:

Step 3:

Step 4:

or, as a single relational algebra expression:

Set operations eliminate duplicates


Слайд 5
Set operations (attributes naming)
 
 
 
 


Слайд 6CARTESIAN PRODUCT Operation (CROSS PRODUCT)
 
Cartesian product operation produces a new element by

combining every tuple from one relation with every tuple from the other relation.

 

The CARTESIAN PRODUCT operation by itself is generally meaningless, except when followed by a selection that matches values of attributes coming from the component relations.


Слайд 7CARTESIAN PRODUCT Operation
Example: retrieve a list of names of each female

employee’s dependents

Step 1:

Step 2:

Step 3:

Step 4:

Step 5:

Step 1:

Resulting Relations:


Слайд 8CARTESIAN PRODUCT Operation
Step 2:
Step 3:


Слайд 9CARTESIAN PRODUCT Operation
Step 4:
Step 5:
Because this sequence of CARTESIAN PRODUCT followed

by SELECT is quite commonly used to combine related tuples from two relations, a special operation, called JOIN, was created to specify this sequence as a single operation.

Слайд 10 
 
Example: retrieve the name of the manager of each department.
SELECT d.Dname,

e.Fname, e.Lname
FROM EMPLOYEE e, DEPARTMENT d
WHERE Ssn = Mgr_ssn;



Слайд 11 
 
 
where is of the form:

AND AND … AND (condition)

 

 


Слайд 12NATURAL JOIN
 
Example: retrieve the name of the manager of each department.
 
 


Обратная связь

Если не удалось найти и скачать презентацию, Вы можете заказать его на нашем сайте. Мы постараемся найти нужный Вам материал и отправим по электронной почте. Не стесняйтесь обращаться к нам, если у вас возникли вопросы или пожелания:

Email: Нажмите что бы посмотреть 

Что такое ThePresentation.ru?

Это сайт презентаций, докладов, проектов, шаблонов в формате PowerPoint. Мы помогаем школьникам, студентам, учителям, преподавателям хранить и обмениваться учебными материалами с другими пользователями.


Для правообладателей

Яндекс.Метрика