Lecture 5- Relational Algebra Flashcards

1
Q

What are the three variants of relational query language?

A
  1. Relational algebra
  2. Relational calculus
  3. SQL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is algebra?

A

The study of operations in an abstract level on some domains (as a language, study of syntax and semantics of expressions)

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

What are two parts of relational algebra?

A
  1. Domain= set of all relations
  2. Expressions= referred to as queries
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Operations on one table vs two tables?

A
  • Operations on one table= pick some rows, pick some columns
  • Operations on two tables= join
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the domain, basic operations and derived operators?

A
  1. Domain = set of relations
  2. Basic operations = select, project, union, set difference, cartesian product, renaming
  3. Derived operators = set intersection, division, join
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe the role of algebra inside of a DBMS

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

What is a select operator?

A

Select rows that satisfy the condition

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

This is an example of what?

A

Select operator

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

This is an example of what?

A

Select operator

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

What are the operators for select condition?

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

What are some simple selection conditions?

A
  • < attribute> operator < constant>
  • < attribute> operator < attribute>
  • < condition> AND < condition>
  • < condition> OR < condition>
  • NOT < condition>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a project operator?

A

Project on (or pick) a subset of columns

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

This is an example of what?

A

Project operator

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

This is an example of what?

A

Project operator

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

What are some set operator operations?

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

Two relations are union compatible if?

A
  • Both have the same number of columns
  • Names of attributes with the same name in both relations have the same domain
17
Q

Union compatible relations can be combined using?

A
  • Union
  • Intersection
  • Set difference
18
Q

This is an example of what?

A

Set operator

19
Q

What is the cartesian product?

A

R x S is the set of all concatenated tuples < x,y>, where x is a tuple in R and y is a tuple in S

20
Q

For cartesian products, relations ________

A

Don’t have to be union compatible

21
Q

R x S can be ____ and expensive to compute

A

Huge

22
Q

How to compute the cartesian product?

A
23
Q

What is renaming?

A
  • Expr returns a relation
  • Rename the resulting relations to x with the first column in the result relation to A1, the second to A2, etc
24
Q

This is an example of what?

A

Renaming

25
Q

This is an example of what?

A

Renaming

26
Q

What is a common usage of renaming?

A
  • To clean up the result
  • To prepare the result for the next operation
27
Q

What is join (derived operator)?

A

A (general or theta) join of R and S is the expression

28
Q

Join definition is equivalent to what?

A
29
Q

This is an example of what?

A

Join (derived operator)

30
Q

This is an example of what?

A

Join (derived operator)

31
Q

What is equijoin?

A
  • A special case of condition join where the condition contains only equalities
  • Result schema similar to cross product, but only one copy of fields for which equality is specified
  • Equijoin= join condition is a conjunction of equalities
32
Q

This is an example of what?

A

Equijoin

33
Q

What is a problem and solution to join?

A
  • Problem= if R and S have attributes with the same then the Cartesian product is not well defined
  • Solution 1= rename attributes prior to forming the product and use new names in join-condition
  • Solution 2= common attribute names are qualified with relation names in the result of the join
34
Q

What is natural join?

A
  • Special case of equijoin
  • Join condition equates all and only those attributes with the same name (condition doesn’t have to be explicitly stated)
  • Duplicate columns eliminated from the result
35
Q

This is an example of what?

A

Natural join

36
Q

What is division?

A

Finds tuples in one relation r that match all tuples in another relation s (can be expressed in terms of projection, set difference and cross product)

37
Q

This is an example of what?

A

Division (derived operator)

38
Q

This is an example of what?

A

Division (derived operator)