Week 3 Flashcards

1
Q

What does UNION do?

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

What does DIFFERENCE do?

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

What does entity integrity mean?

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

What does relational integrity mean?

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

What are superkeys?

A

An attribute or set of attributes which identify a particular tuple.

Their only property is that they are unique.

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

What are candidate keys?

A

These are a subset of superkeys that have no subset that can be a superkey.

They are also referred to as MINIMAL superkeys.

A primary key is chosen from the candidate keys.

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

What are the attributes needed to allow a union between relations?

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

What are secondary keys?

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

What does SELECT/RESTRICT do? Notation

A

Returns a horizontal subset within a relation.

Sigma

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

What does PROJECT do? Notation?

A

Returns a vertical subset in a relation.

Pi

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

Are candidate keys superkeys? Whats the difference?

A

Yes. Candidate keys have no redundant components. All the components are required to indentify whatever the candidate key is for.

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

What does a relation consist of?

A
  • Heading

- Body

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

What is a relation heading/relational schema?

A

Consists of all fixed set of attributes for relation R

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

What are tuples?

A

Instances of the heading,

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

What is a relation body/instance

A

Consists of a time varying set of n-tuples.

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

What is referred by relation cardinality?

A

The number of tuples

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

What is the relation degree?

A

The number of valies in tuple (number of attribute)

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

What are the fundamental relation properties?

A
  • NO duplicate tuples
  • Tuples are UNORDERED within a relation
  • NO ordering of attributes within a tuple
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are the fundamental relation properties?

A
  • NO duplicate tuples
  • Tuples are UNORDERED within a relation
    • can only be accesed via data within tuple
  • NO ordering of attributes within a tuple
  • Tuple values are atomic (cant be divided)
20
Q

Are tables and relations the same?

A

NO, tables are visual/tabula representations of relations. THEY ARE NOT THE SAME.

21
Q

Are multivalued/repeating attributes allowed in a tuple?

A

No

22
Q

What is functional dependancy?

A

When one attribute determines another attribute.

Attribute A can be be used to determine attribute B.

Attribute A = unique

23
Q

What are alternate keys?

A

These are candidate keys that were NOT chosen as PKs

23
Q

What are alternate keys?

A

These are candidate keys that were NOT chosen as PKs

24
Q

What is a surrogate key?

A

This is an attribute that is soley present to act as a primary key.

25
Q

Should primary keys be free of semantics?

A

Yes, they should not provide any additional information (especially important info)

E.g. Although TFN could be a PK, best not to use TFN in a public setting as it is private info.

26
Q

What is a NULL?

A

This refers to when there is NO VALUE.

NOTE: 0 IS NOT A NULL VALUE

27
Q

Do NULLs exist in the relational model?

A

NO, they were only implemented by the relation database system.

28
Q

What is the naming convention for relations?

A
  • Name is all caps and singular
  • PK is start of tuple and underlines
  • Rest of attributes NOT ordered
29
Q

Is there redundant data in a relational database?

A

YES, a minimal amount in foreign keys/composite keys.

30
Q

What are the functions of a PK?

A
  • To ensure that a tuple is unique

- To act as a foreign key to relate (logical connection between) tuple

31
Q

What are the rules for FKs?

A
  • They MUST point to a COMPLETE PK

- If no match with full PK then NULL

31
Q

What are the rules for FKs?

A
  • They MUST point to a COMPLETE PK

- If no match with full PK then NULL

32
Q

Do FKs need the same name as PKs?

A

No, they can have different names.

33
Q

What is domain/column integrity?

A

All values in a given column must come from the same domain (same datatype and within the range)

34
Q

What does a “closure” property refer to?

A

Queries on relations produce relations.

34
Q

What does a “closure” property refer to?

A

Queries on relations produce relations.

35
Q

What is procedural?

A

You have to specify the instructions as well as the order of instructions.

36
Q

What are the basic operations in relational algebra?

A

single relation: selection, projection

two relations:

  • cartesian product, join
  • union
  • intersection
  • difference
  • division
37
Q

What does JOIN do?

A

Combines data from two or more relations based on a common attribute or attributes

38
Q

Types of joins?

A
  • Theta (generalised join)
  • Equi
  • Natural
39
Q

What is a theta join?

A

RELATION.attribute F RELATION2.attribute

F is an operator ( etc.)

40
Q

What is a natural join?

A

Projection of the results from an equijoin ???

41
Q

What is an equijoin?

A

A join where two attributes are made to be equal

42
Q

What is a canonical query?

A
43
Q

What is a canonical query?

A
44
Q

Ways to be more efficient when querying?

A

Grabbing data as early as possbile