Midterms - Relational algebra Flashcards

1
Q

Identification

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

Identification

Generate a relation with tuples that contains only speciefied attributes

  • Can rearrange order of attributes
  • Can manipulate values
A

Projection

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

Identification

Choose a subset of the tuples 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

Identification

acts 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

Identification

Can combine multiple predicates using conjuctions/disjunctions

A

Select

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

Identification

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

Identification

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

Identification

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

Identification

Generate a relation that contains all tuples that are a combination 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

Identification

Generate a relation that contains all possible combinations of tuples from the input relations

A

Product

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

Relational Algebra: Syntax

Product

A

R × S

SELECT * FROM R CROSS JOIN S;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Relational Algebra: 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

Relational Algebra: 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

Relational Algebra: Syntax

Union

A

R ∪ 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

Relational Algebra: Syntax

Intersection

A

R ∩ S

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

Intersect is not supported in mysql, use alternative: Inner Join

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

Relational Algebra: Syntax

Select

A

σcondition(relation)

Select * from R WHERE a_id = 'a2' AND b_id > 102
17
Q

Relational Algebra: Syntax

Projection

A

π attribute1, attribute2, …(relation)

Select b_id-100, a_id FROM R WHERE a_id = 'a2'