Exam 1.4 Flashcards

(19 cards)

1
Q

Relations operators

A

selection
projection
cross product
set difference
union

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

What is sign for selection and what it does

A

σ.cond sigma selects subset of rows from relation that mean condition

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

what is sign for projection and what it does

A

Π pi deletes unwanted rows from relation projection removes duplicatess

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

symbol for cross product and what it does

A

X cross produce allows combining relations

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

symbol for set difference and what it does

A
  • takes tuples in relation 1 but not in relation 2
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

symbol for union and what it does

A

U takes tuples in relation 1 or relation 2

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

meaning of A ⊇ B

A

A contains all elements of B (B is a subset of A).

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

Meaning of A ⊆ B

A

A is a subset of B if all elements of A exist in B.

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

rename operator

A

works by doing pi(1->id, )

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

How does renaming work in SQL

A

rho p([new],p[oldname])

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

Conditional join of R ⋈ cS

A

take everything from R and S and apply condition to it

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

Equijoin

A

join condition consists of only inequalities
doesn’t drop tables that aren’t used

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

natural join

A

joins two tables with same name but drops tables that don’t have the same name

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

What is faster join or cross product

A

joins

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

what would this do -> pi (sname)

A

only show the sname column

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

what would this do -> (Temp1 ,sigma.bid = 103 Reserves)

A

only selects bid of 103 from reseves

17
Q

what would this do p(temp1, sigma.bid = 103 Reserves)

A

copies bid of 103 in reserves to temp1

18
Q

π.sname (π.sid ((π.bid σ.color=‘red’Boats) ⋈ Res) ⋈ Sailors)

A

Selects name of sailors who reserved a red boat

19
Q

how does division work A/B are the tables

A

will give the tables in A that have columns in B