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
Explain the usage of References
26
What is a Foreign Key?
27
Can relationships have attributes?
28
29
30
Can a relationship have a key?
31
32
How to differentiate between entity and relationship?
33
Describe a Many-to-Many Relationship.
34
Describe a Many-to-One relationship.
35
Describe a Many-to-”exactly one”.
36
Describe a "One-to-One" relationship.
37
How do you translate Many-to-Many relationship?
38
39
What does NULL mean?
40
41
Is this a good or bad design?
42
When should we model something as an entity in its own right (as opposed to an attribute of another entity)?
43
44
How to translate this?
45
Translate schema.
46
Translate to schema.
47
Translate to schema.
48
Explain SubClassing.
49
Explain what ISA means in this context.
50
Can a subclass have many superclasses?
51
How to Translate ISA to relations?
52
53
What are 2 Alternate ISA translations to the E-R approach?
54
55
56
How is E-R in comparison to Object Oriented and NULL approach?
57
How does Object Oriented compare to E-R and NULL approach?
58
How does NULL compare to the E-R and Object Oriented approach?
59
What are Weak Entities?
60
What are Weak Entities dependent on? How do you draw a Weak Entity?
61
62
How are Weak Entities' discriminator drawn?
63
Explain how Multiway Relationships can be modeles as Weak Entities.
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
Should you use Multivalued Attributes?
”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
Should you use "Flag" attributes on relationships?
”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
Does and don'ts of special relationships?
67