Anda di halaman 1dari 1

1.

What is relational algebra


a. Formal language
2. How does relational algebra works?
a. Five basic operation is selection, projection, Cartesian product, union and set difference
b. 3 Derivation from basic is Join, Intersection and Division
3. Describe basic operation
a. Selection: select tuple or rows –
b. Projection: select column or attributes |
c. Cartesian product: Multiple 2 tables P = {a,b}, Q = {1,2,3}. P x Q = {a,1,a,2,a,3,b,1,b,2,b,3}
d. Union: combination of two tables (Have to have same attributes)
e. Intersection: intersection of two tables (maybe want to select data from both tables but
not all)
f. Set difference: difference or minus between two table
4. Describe derived operation
a. Join is divided into Natural Join, Semi Join and Lect Outer Join
b. Natural join is joining two tables that have common attributes
c. Semijoin: Do Natural join but only wants one right side/ not more than one match
d. Left outer join: Do natural join, but don’t remove the left side (take all), also, shows
value that are matched in C
e. Division: remove which are matched, b with b, then take a that have b removed.
5. Explain how to use selection
a. salary > 10000 (Staff)
b. Select rows salary that are higher than 10, 000
6. Explain how to use projection
a. staffNo, fName, lName, salary(Staff)
b. Select column with staffno, first name, last name and salary in table Staff
7. Make a formula to to select both formula
a. staffNo, fName, lName, salary(salary > 10000 (Staff))
8. Explain how to use union
a. city(Branch)  city(PropertyForRent)
b. Combine both table with attribute city, combine, and omit the same value
c. E,g, call city in both country is displayed
9. Explain how to use set difference
a. city(Branch) – city(PropertyForRent)
b. Only one city is displayed because the same is removed
10. Explain how to use intersection
a. city(Branch)  city(PropertyForRent)
b. Denoted by reverse U, R  S = R – (R – S)
11. How to use Cartesian product
a. To match certain things, because same number is multiply in the tables
b. Usually used with selection to remove multiple of data

Anda mungkin juga menyukai