Week 2 Revision Flashcards

1
Q

What is inheritance?

A

The process by which a lower level entity set inherits all the attributes and relationship participation of the higher level entity set to whcih it is linked

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

What are some benefits of inheritance?

A

<ul>
<li>Avoids duplication of data</li>
<li>Allows relationships between similar types of entities to be represented</li>
</ul>

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

What does the completeness constraint specify?

A

Whether an entity in the superclass entity set must belong to at least one of the entity sets within a generalization

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

What are the two types of constraint inheritance?

A

Total

Partial

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

Describe total inheritance

A

An entity MUST belong to one of the subclass entity sets

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

Describe partial inheritance

A

An entity need not belong to one of the subclass entity sets, can be a member of the superclass

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

What does the inheritance constraint specify?

A

Constrinat on whether or not entities may belong to more than one subclass entity set within a single generalization

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

What are the two types of inheritance?

A

Overlapping

Disjoint

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

What is overlapping inheritance?

A

An entity can belong to more than one subclass

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

What is disjoint inheritance?

A

An entity can belong to at most one suclass

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

What are some ER design decisions that need to be made at the modelling stage?

A
<ul>
<li>Entity set vs attribute</li>
<li>Etity set vs relationship set</li>
<li>Placement of attribute on entity set or relationship set</li>
<li>Use of n-ary relationship set vs multiple binary</li>
<li>Strong vs weak entity set</li>
<li>Specalisation</li>
</ul>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When would you use an entity set over an attribute?

A

When you want/need to store additional information aboyt that field i.e. mobile number

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

When would you use a relationship set over an entity set?

A

If all the relationships leading from an entity set are complete (have to participate) and are described using generic verbs such as ‘has’

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

Where is an attribute of a many to many relationship placed?

A

On the relationship set

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

Where is an attribute of a one to many relationship set placed?

A

On the relationship set or the many side entity set

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

Where is an attribute of a one to one relationship set placed?

A

On the relationship set or in either entity set

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

Even though it’s possible, what is a reason for not replacing any n-ary relationship set with binary relationship sets?

A

An n-ary relationship set shows more clearly that several entities participate in a single relationship

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

What are some alternatives to subclasses?

A

<ul>
<li>Use an attribute to distinguish between groups</li>
<li>Use relationships and roles to distinguish between groups</li>
</ul>

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

When could you use an attribute instead of subclasses?

A

When subclasses have no attributes or relationships (fiction vs non fiction)

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

When could you use roles instead of subclasses?

A

<ul>
<li>Potential subclasses have the same attributes</li>
<li>Specalisation would be overlapping</li>
<li>Relationships with potential subclasses are optional</li>
</ul>

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

What are the four steps in the simple modelling methodology?

A

<ol>
<li>Decide what entity sets are required</li>
<li>For each entity set, decide on attributes</li>
<li>Decide on relationships between entity sets</li>
<li>Decide on generalisation/specialisation</li>
</ol>

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

What does cardinality deal with?

A

Maximum times they can participate

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

What does participation deal with?

A

Minimum times they can participate

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

Describe the relational model

A

<ul>
<li>One step down from the E.R model</li>
<li>A means of storing information in tables called relations</li>
<li>Defines the structure, manipulation and constraints</li>
</ul>

25
Q

What is the domain of an attribute?

A

The set of allowed values for each attribute

26
Q

What does atomic mean in the context of attribute values?

A

Indivisible, cannot be chopped into any smaller chunks

27
Q

What are some properties of relations?

A

<ul>
<li>Each relation has a distinct name</li>
<li>Each cell is atomic</li>
<li>Attributes in a relation have distinct names</li>
<li>Values of an attribute are of the same domain</li>
<li>There are no duplicate tuples in a relation</li>
<li>The order of the attributes and the tuples has no significance</li>
</ul>

28
Q

What is the definition of a superkey?

A

Let K be a set of attributes in the relation schema R. K is a superkey of R if values for K are sufficient to identify a unique tuple of each possible relation r(R).

29
Q

What makes a superkey a candidate key?

A

A superkey K is a candidate key if K is minimal.

30
Q

How is a primary key represented in relational schema?

A

Underlined

31
Q

How is a foreign key represented in relational schema?

A

Followed by a star

32
Q

What are the two pure relational query languages?

A

<ol>
<li>Relational algebra</li>
<li>Relational calculus</li>
</ol>

33
Q

What type of language is relational algebra?

A

Procedural

34
Q

What type of language is relational calculus?

A

Declarative

35
Q

Describe relational algebra

A

Relational algebra explains how to obtain the result, by giving a functional description in terms of mathematical functions

36
Q

Describe relational calculus

A

Relational calculus explains what is required to obtain the result, by giving a declarative description

37
Q

What are relations in relational algebra?

A

Operands

38
Q

What are the various operations such as select and join in relational algebra?

A

Operators

39
Q

What are the two types of operations in relational algebra?

A

Unary and binary

40
Q

What are the unary operations?

A

Select, project, rename

41
Q

What are the binary operations?

A

Union, set difference, cartesian product

42
Q

What are the derived operations of relational algebra?

A

Set intersection, natural join

43
Q

Describe the select operation

A

Equivalent to filtering, will only return the rows where a certain condition holds (the selection predicate)

44
Q

Describe the project operation

A

Will return the columns that are listed in the project operation and nothing else

45
Q

Describe the rename operation

A

Will allow reference t a relation by more than one name

46
Q

Describe the union operation

A

Will return tuples that appear in both of the relations

47
Q

Define arity

A

Number of attributes in a relation

48
Q

What must hold for union of two relations to be valid?

A

<ol>
<li>The two relations must have the same arity</li>
<li>The second column of each table must have the same type of value as the other table</li>
</ol>

49
Q

Describe the set difference operation

A

Will return tuples that appear in the first but not the second relation

50
Q

What must hold for the set difference of two relations to be valid?

A

<ol>
<li>The two relations must have the same arity</li>
<li>The attribute domains of the relations must be compatible</li>
</ol>

51
Q

Describe the cartesian product operation

A

Will return each tuple in one relation joined with each tuple in the other relation

52
Q

Describe the set intersection operation

A

Will return tuples that appear in both of the given relations

53
Q

What must hold for the set intersection operation to be valid?

A

Relations must be compatible

54
Q

What does it mean to be compatible relations?

A

<ol>
<li>Relations must have the same arity</li>
<li>Attribute domains of the two relations must be compatabile</li>
</ol>

55
Q

Describe the natural join operation loosely

A

Combine relations with matching values of common attributes in both relations

56
Q

Describe the natural join operation in terms of other operations

A
  1. Form cartesian product of two relations r and s
  2. Perform a selection using equality on all common attributes
  3. Remove duplicate attributes using projection
57
Q

Describe a relation

A

Set of tuples whcih represent instances of an entity set

58
Q

Describe a relational schema

A

Blueprint used to describe what information will be stored in a database and how it’ll be divided into relations

59
Q

List two reasons why null values may introduced into a database

A

<ol>
<li>Indicate information is missing</li>
<li>Indicate information is unknown</li>
</ol>