Converting EER to DB Flashcards

(54 cards)

1
Q

relational data model

A

physically represented as a set of relations or tables that store data

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

3 components of relational data model

A
  • relational data structure - Where to store data?
  • data manipulation - how to manipulate data?
  • relational data integrity - how to maintain integrity?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

main data structure used in relational data structure

A

relation

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

relation

A

two-dimensional grid/table that holds data about a set of objects

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

each row in RDS represents

A

an instance of an entity

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

each column in RDS represents

A

properties or attributes of an object

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

relational schema

A

a specification of the name of the relation, followed by list of attributes/columns from table

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

t/f: in a relational schema, you do not underline the primary key

A

false

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

assigning NULL as cell value is diff than leaving it blank because

A

it indicates that the decision was made to assign that value

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

data manipulation

A

a way to access and manipulate data in the relations

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

example of a manipulation language

A

structured query language (SQL)

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

2 types of database integrity constraints

A

entity integrity and referential (reference) integrity

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

super key

A

attribute/combination of attributes that uniquely identifies each row in the table

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

candidate key

A

minimal (irreducible) superkey
- a super key that doesn’t contain a different super key as a part of it

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

primary key

A

candidate key selected to be used as primary row identifier

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

a primary key is a type of ______, which is a type of ________

A

candidate key, super key

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

a primary key cannot contain

A

NULL entries

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

foreign key

A

attribute/combination of attributes in one table whose values must either match primary key in another table, or be NULL

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

secondary key

A

attribute(s) used for data retrieval

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

entity integrity implies that:

A
  • every relation in relational data model has a unique primary key
  • the data values for all attributes in primary key are not NULL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

referential integrity implies that:

A
  • every non-NULL foreign key references an existing primary key value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

enforcing referential integrity rule means

A

it’s impossible to have an invalid foreign key value, or to delete a row whose primary key has matching foreign key values in another table

23
Q

enforcing entity integrity rule ensures

A

primary key values exist

24
Q

if a student is part of a department, and the department is removed from the database:

A

must remove student or move to different department or change foreign key value to null to ensure referential integrity

25
t/f: relations can be complex
false. they present one consistent method of representing data
26
no matter how complex the ER diagram is, the end result of the DB is
a set of related tables defined with keys
27
standard notation
foreign key points to associated primary key(s)
28
four primary elements from an ER diagram that we need to find a way to represent
- entities with attributes - relationships with cardinalities - associative entities - supertypes/subtypes
29
first step in mapping ER to DB
mapping entities to relations and their attributes into columns
30
simple attributes (mapping)
ER attributes map directly onto relation
31
composite attributes use
only their simple, component attributes
32
multi-valued attribute becomes
a separate relation with a foreign key taken from the superior entity
33
a customer entity type with only simple attributes looks like _______ and is mapped into _______ for a relation
- rectangle with connected ovals - 3 columns (1 per attribute)
34
standard practice to list primary key as ______ in relational database
first column
35
mapping a customer entity type with 3 attributes, one of which is a composite attribute
the relation has the first two attributes as columns, and then the components OF the composite attribute (not the composite itself) as the other columns
36
when mapping a multi-valued attribute,
it becomes a separate relation with a foreign key (make a copy of original table's primary key and place it in the new table)
37
the primary key added to a multi-valued attribute's relation can only be a foreign key because
primary key value has to be unique for every single row, and a multi-valued attribute can have multiple rows for he same entity
38
mapping a multi-valued attribute as a separate relation creates a
one to many relationship between the entity and the multi-valued attribute
39
mapping a weak entity
becomes a relation with a foreign key that is adopted from its associated strong entity's primary key
40
primary key for weak entity relation is composed of (and equals)
- partial identifier of weak entity - primary key of identifying relation (strong entity) = composite primary key
41
example of weak entity mapping with employee and dependent
dependent of employee is weak entity. it becomes its own relation, and its composite primary key consists of the primary key, employee_id, from employee strong entity, and the name of the dependent
42
3 types of binary relationships
one-to-many, one-to-one, many-to-many
43
one-to-many
primary key on one side becomes a foreign key on the many side
44
one-to-one
primary key on the mandatory side becomes a foreign key on the optional side
45
many-to-many
creates a new relation with the primary keys of the two entities as its primary key
46
with a many-to-many relationship,
an associative entity is formed between two original entities
47
mapping supertype/subtype relationships
define one relation for the supertype and one for each subtype
48
when mapping, subtype-specific attributes go into ______, and primary key of supertype also becomes _____
each subtype, primary key of subtype relation
49
when mapping super/sub, a 1:1 relationship is established between
supertype and each subtype, with supertype as primary table
50
two unary relationship types
one to many and many to many
51
for one-to-many, you add a
new column for the foreign key
52
for ternary relationships, you create a
fourth relation that represents the ternary relationship
53
for ternary relationships, the primary key from the first three relations
migrates to the new ternary relation
54
when we convert EER diagrams to relations (downside)
some of the richness of the context is lost