Relational Algebra Flashcards

1
Q

Relational Query Languages do what?

A

allow the manipulation and retrieval of data from a database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

two types of query languages

A

declarative, procedural

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Declarative query language

A

describe what a user wants, rather than how to compute it (TRC, DRC)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Procedural query language

A

operational, useful for representing execution plans (relational alg)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

relational query languages

A

can’t capture any type of computation, not intended for complex computations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

algebra

A

operands - varialbes or values from which new values can be constructed
operators - symbols denoting procedures that construct new values from given values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

relational algebra

A

an algebra whose operands are relations or variables that represent relations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Selection

Oc(R)

A

outputs the rows of R that satisfy C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Projection

PIa(R)

A

outputs only the columns A1, A2, …An, removes duplicate tuples

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Union R1 U R2

A

outputs all tuples in R1 or R2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Difference

R1 - R2

A

outputs all tuples in R1 and not in R2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Cross Product

R1 x R2

A

matches each tuples in R1 with each tuple in R2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Renaming

Pa(R)

A

does not change the instance, only the schema

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Intersection

R1 ^ R2

A

outputs all tuples in R1 and R2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Theta Join

A

Cross product followed by a selection

condition = any boolean valued condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Equi-Join

A

Condition C contains only equalities between attributes

17
Q

Natural Join

A
  • equi-join on all the common fields

- the output schema has one copy of each common attribute

18
Q

Semi-Join

R1 (bowtie) R2

A

natural join followed by projection on the attributes of R1

19
Q

Division

R1/R2

A

all values a such that for every tuple b in R, tuple (a, b) is in R1

20
Q

Group by Aggregate

A

group by the attributes in X

aggregate the attribute in Y

21
Q

RA cannot express what?

A

Transitive closure - all pairs of nodes connected by a direct path