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
What is the domain of an attribute?
The set of allowed values for each attribute
26
What does atomic mean in the context of attribute values?
Indivisible, cannot be chopped into any smaller chunks
27
What are some properties of relations?
  • Each relation has a distinct name
  • Each cell is atomic
  • Attributes in a relation have distinct names
  • Values of an attribute are of the same domain
  • There are no duplicate tuples in a relation
  • The order of the attributes and the tuples has no significance
28
What is the definition of a superkey?
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
What makes a superkey a candidate key?
A superkey K is a candidate key if K is minimal.
30
How is a primary key represented in relational schema?
Underlined
31
How is a foreign key represented in relational schema?
Followed by a star
32
What are the two pure relational query languages?
  1. Relational algebra
  2. Relational calculus
33
What type of language is relational algebra?
Procedural
34
What type of language is relational calculus?
Declarative
35
Describe relational algebra
Relational algebra explains how to obtain the result, by giving a functional description in terms of mathematical functions
36
Describe relational calculus
Relational calculus explains what is required to obtain the result, by giving a declarative description
37
What are relations in relational algebra?
Operands
38
What are the various operations such as select and join in relational algebra?
Operators
39
What are the two types of operations in relational algebra?
Unary and binary
40
What are the unary operations?
Select, project, rename
41
What are the binary operations?
Union, set difference, cartesian product
42
What are the derived operations of relational algebra?
Set intersection, natural join
43
Describe the select operation
Equivalent to filtering, will only return the rows where a certain condition holds (the selection predicate)
44
Describe the project operation
Will return the columns that are listed in the project operation and nothing else
45
Describe the rename operation
Will allow reference t a relation by more than one name
46
Describe the union operation
Will return tuples that appear in both of the relations
47
Define arity
Number of attributes in a relation
48
What must hold for union of two relations to be valid?
  1. The two relations must have the same arity
  2. The second column of each table must have the same type of value as the other table
49
Describe the set difference operation
Will return tuples that appear in the first but not the second relation
50
What must hold for the set difference of two relations to be valid?
  1. The two relations must have the same arity
  2. The attribute domains of the relations must be compatible
51
Describe the cartesian product operation
Will return each tuple in one relation joined with each tuple in the other relation
52
Describe the set intersection operation
Will return tuples that appear in both of the given relations
53
What must hold for the set intersection operation to be valid?
Relations must be compatible
54
What does it mean to be compatible relations?
  1. Relations must have the same arity
  2. Attribute domains of the two relations must be compatabile
55
Describe the natural join operation loosely
Combine relations with matching values of common attributes in both relations
56
Describe the natural join operation in terms of other operations
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
Describe a relation
Set of tuples whcih represent instances of an entity set
58
Describe a relational schema
Blueprint used to describe what information will be stored in a database and how it'll be divided into relations
59
List two reasons why null values may introduced into a database
  1. Indicate information is missing
  2. Indicate information is unknown