Relational Data Model Flashcards

1
Q

Explain the concept of map the domain?

A

”Map” the domain, find out what the
database is intended to model
– The database should accept all data possible
in reality
– The database should agree with reality and
not accept impossible or unwanted data

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

Which setup is the blueprint for the database?

A

Construct the ”blueprint” for the database
– the database schema

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

What is a Database Schema?

A

Database Schemas
• A database schema is a set of relation
schemas
• A relation schema has a name, and a set
of attributes (+ types):

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

Explain difference between Schema vs Instance

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

Explain how you go from Schema to Database.

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

Why should we have relations in databases?

A

Why relations?
• Relations often match our intuition
regarding data
• Very simple model
• Has a good theoretical foundation from
mathematics (set theory)
• The abstract model underlying SQL, the
most important database language today

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

Explain Keys

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

What are composite keys?

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

What are the things to avoid when construction databases?

A

Things to avoid!
• Redundancy
• Unconnected relations
• Too much decomposition

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

Describe a database schema

A

A database schema is a blueprint
- Consists of a set of relations e.g. Courses(code, name, teacher)
where “Courses” is the relation name and code, name and teacher are
attributes.

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

What are tuples?

A

A database instance holds actual data

  • Tuples are instances of a relation.
  • E.g. (‘TDA357’, ‘Databases’, ‘Mickey’)

In a DBMS, a table holds relations where:

  • Each row holds a tuple
  • Each column stores a different attribute
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a DBMS?

A

Data Base Management System

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

What are keys?

A

Keys uniquely identify the other values of a tuple in a relation
- Composite keys combine several attributes

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

What is the Entity-Relationship approach

A

The Entity-Relationship approach
• Design your database by drawing a picture
of it – an Entity-Relationship diagram
– Allows us to sketch the design of a database
informally (which is good when
communicating with customers)
• Use (more or less) mechanical methods to
convert your diagram to relations.
– This means that the diagram can be a formal
specification as well

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

Which are the three main elements of an E/R diagram?

A

E/R Model
• Three main element types:
– Entity sets
– Attributes, and
– Relationships

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

What are entities?

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

What are Entities set?

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

What are Attributes?

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

What is a Relationship?

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

How to translate E/R to Schema?

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

Explain the usage of References

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

What is a Foreign Key?

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

Can relationships have attributes?

A
28
Q
A
29
Q
A
30
Q

Can a relationship have a key?

A
31
Q
A
32
Q

How to differentiate between entity and relationship?

A
33
Q

Describe a Many-to-Many Relationship.

A
34
Q

Describe a Many-to-One relationship.

A
35
Q

Describe a Many-to-”exactly one”.

A
36
Q

Describe a “One-to-One” relationship.

A
37
Q

How do you translate Many-to-Many relationship?

A
38
Q
A
39
Q

What does NULL mean?

A
40
Q
A
41
Q

Is this a good or bad design?

A
42
Q

When should we model something as an
entity in its own right (as opposed to an
attribute of another entity)?

A
43
Q
A
44
Q

How to translate this?

A
45
Q

Translate schema.

A
46
Q

Translate to schema.

A
47
Q

Translate to schema.

A
48
Q

Explain SubClassing.

A
49
Q

Explain what ISA means in this context.

A
50
Q

Can a subclass have many superclasses?

A
51
Q

How to Translate ISA to relations?

A
52
Q
A
53
Q

What are 2 Alternate ISA translations to the E-R approach?

A
54
Q
A
55
Q
A
56
Q

How is E-R in comparison to Object Oriented and NULL approach?

A
57
Q

How does Object Oriented compare to E-R and NULL approach?

A
58
Q

How does NULL compare to the E-R and Object Oriented approach?

A
59
Q

What are Weak Entities?

A
60
Q

What are Weak Entities dependent on? How do you draw a Weak Entity?

A
61
Q
A
62
Q

How are Weak Entities’ discriminator drawn?

A
63
Q

Explain how Multiway Relationships can be modeles as Weak Entities.

A

Multiway relationships as WEs
• Multiway relationships can be transformed
away using weak entities
– Subtitute the relationship with a weak entity.
– Insert supporting relationships to all entities
related as ”many” by the original relationship.
– Insert ordinary many-to-one relationships to
all entities related as ”one” by the original
relationship.

What’s the point?
• Usually, relationships work just fine, but in
some special cases, you need a weak
entity to express all multiplicity constraints
correctly.
• A weak entity is needed when a part of an
entity’s key is a foreign key.

64
Q

Should you use Multivalued Attributes?

A

”Multivalued” attributes
• Inflexible if you later want more attributes on
teachers.
• No guarantees against e.g. spelling errors of
teacher names.
– less flexible to insert a constraint on what values are
allowed than to use an extra table.
• Tables are cheap – references are cheap
– No reason NOT to use an entity.
• Rule of thumb: Don’t use multivalued attributes!!

65
Q

Should you use “Flag” attributes on relationships?

A

”Flag” attributes on relationships
• Less intuitively clear.
• Inflexible if later you need more roles.
• Tables are cheap, union of two tables is a cheap
operation (O(1)) – filtering can be expensive (O(n))!
• Only benefit: automatic mutual exclusion (a teacher can
only be either responsible or an assistant).
– If important, can be recovered via assertions (costly).
• Rule of thumb: Don’t use flag attributes on relationships!

66
Q

Does and don’ts of special relationships?

A
67
Q
A