Relational Algebra Flashcards

1
Q

Fundamental operations to retrieve and manipulate tuples in a relation

A

Relational Algebra

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

Identify:

Generate a relation with tuples that contains only specified attributes

  • Can rearrange order if attributes
  • Can manipulate values
A

Projection

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

Identify:

choose a subset of the tuple from a relation that satisfies a selection predicate

A

Select

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

Identify:

Act as a filter to retain only tuples that fulfill its qualifying requirement

A

Predicate

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

Identify:

Can combine multiple predicates using conjunction/disjunctions

A

Select

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

Identify:

Generate relation that contains only the tuples that appear in both of the input relations

A

Intersection

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

Identify:

Generate a relation that contains all tuples that appear in either only one or both input relations

A

Union

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

Identify:

Generate a relation that contains only the tuples that appear in the first and not the second of the input relations

A

Difference

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

Identify:

Generate a relation that contains all tuples that are a combination of of two tuples with common values for one or more attributes

A

Join

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

Identify:

Generate a relation that contains all positive combinations of tuple from the input relations

A

Product

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

Syntax:

Product

A

R x S
SELECT * FROM R CROSS JOIN S;

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

Syntax:

Join

A

R = S
SELECT * FROM R NATURAL JOIN S;

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

Syntax:

Difference

A

R - S
(SELECT * FROM R)
EXCEPT
(SELECT * FROM S);
Except operation is not supported in mySQL, use alternative: Not in ()

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

Syntax:

Union

A

R U S
(SELECT * FROM R)
UNION ALL
(SELECT * FROM S);

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

Syntax:

Intersection

A

R n S
(SELECT * FROM R)
INTERSECT
(SELECT * FROM S);

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

Syntax:

SELECT

A

Condition (relation)
SELECT * FROM R WHERE a_id = ‘a2’ AND b_id > 102

17
Q

Syntax:

Projection

A

SELECT b_id-100, a_idFROM R WHERE a_id = ‘a2’