Reg algebra girija-projection

Post on 24-Jan-2018

142 views 0 download

transcript

R1 := πL (R2)

L is a list of attributes from the schema of R2.

R1 is constructed by looking at each tuple of R2, extracting the attributes on list L, in the order specified, and creating from those components a tuple for R1.

Eliminate duplicate tuples, if any.

PROJECTION

2

Example: Projection

milk milk_type price Al-marai Full_Fat 2.50 Al-marai Refresh 2.75 Lancor Full_Fat 2.50 Lancor Refresh 3.00

Prices := πmilk,price(Sells):

milk price Al-marai 2.50 Al-marai 2.75 Lancor 2.50 Lancor 3.00

Sells

Display the name column only Display name column whose salary is greater than 80000

Projection – exercise 1

Projection – exercise 1 solution

PROJECTION-exercise 2 solution

PROJECTION-exercise 3

Display Surname,Firstname Display Department,head

PROJECTION-exercise 3 solution

PROJECTION-exercise 4

Display all the Acc-no, title of the book

PROJECTION-exercise 4 Solution

PROJECTION-exercise 5

Display name, dept of the EMP

PROJECTION-exercise 5 Solution

Display age, weight from person

PROJECTION-exercise 6

PROJECTION-exercise 6 solution