Unit 1 and 2 - ER Flashcards

1
Q

What are the three things we need in a database?

A

Entities (students, faculty, courses), attributes of entities (student name, course number, faculty webpage), and relationships between entities (students’ enrollment in a course, faculty teaching courses)

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

What’s a database management system (DBMS)?

A

Software that creates databases and queries the stored data
DBMS Examples: MySQL, Oracle, MongoDB

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

What’s a data model?

A

Collection of high-level data description constructs (tables, graphs, trees) that hide low-level details about physical storage of data.

Common data model = relational data model

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

Data model vs. semantic data model
What’s a widely used semantic model?

A

Semantic data model = more abstract, good initial description, starting point
Translated into a data model that DBMS implements
Widely used semantic data model = ER (entity-relationship) model

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

Types of Attributes: simple (atomic) vs. composite

A

Attribute describes an entity (student name, ID, etc.)
Simple/atomic attribute: cannot be further divided - e.g., student ID
Composite attribute: made up of 2 or more simple attributes - e.g., name is made up of first, middle, last name.

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

Types of Attributes: single-value vs. multi-value

A

Single-value: an attribute that holds maximum one/single value - e.g., employee’s SSN, student ID, GPA
Multi-value: an attribute that has more than one value - e.g., two phone numbers, multiple email addresses

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

Can an attribute be atomic and multi-value?

A

Yes! For example, phone number is atomic b/c you don’t split it out more but multi-value because you can have a home and cell phone number

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

Key (aka relational key)

A

Attribute or set of attributes that uniquely identifies the individual entities within the entity set.
Key attribute cannot be null!

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

Is it possible to have duplicate tuples (rows) in a relation (table)?

A

No. That’s why you can use attributes (relational keys) to UNIQUELY identify a tuple/ row.

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

Candidate key

A

A key that has the minimal number of attributes whose values uniquely identify the individual entity
We can have more than one candidate key per entity!

Candidate keys have two properties:
Uniqueness. In each tuple of R, the values of K uniquely identify that tuple.
Irreducibility. No proper subset of K has the uniqueness property.

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

Primary key

A

ONE of the candidate keys, chosen by database designer
The candidate key that is selected to identify tuples uniquely within
the relation.

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

Instance

A

Snapshot of relationship set at a given time

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

Partial vs. total participation

A

Total - when EACH entity in the entity set is involved in the relationship (represented by double line)
Partial - when not all entities are involved in the relationship (represented by single line)

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

(min, max) notation

For example, each employee can manage 1 department at most, and department must be managed by 1 employee

A

Each entity in the entity set must be linked to at least min number of entities in the relationship, and at most max.

Dept – (1,1) – manages – (0,1) – Employee

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

Strong vs. weak entity

A

An entity is strong if its existence does not depend on another entity.
Weak - existence depends on existence of another entity. (represented by two triangles)

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

How is a weak entity linked to other entites?

A

It’s linked to its strong entity via an ‘identifying relationship’ (two diamonds)

16
Q

How do you identify a strong vs. weak entity?

A

Strong entity - uniquely identifiable thru its primary keys
Weak entity - uniquely identifiable ONLY thru the identifying relationship that it has w/ strong entity (aka NO PRIMARY KEY* for weak entity)

17
Q

Partial key

A

Uniquely differentiates between weak entities

18
Q

Primary key of a weak entity

A

Composite key formed from the primary key of the strong entity + partial key of the weak entity

19
Q

Foreign key

A

Taken from another entity set (e.g., when primary key of strong entity is used as part of primary key of weak entity)

20
Q

Conceptual Hierarchical Design: let’s say we have hourly employees and contract employees, but both have same attributes as regular employees. How to say this?

A

Hourly-Emp ISA (“is a”) Employee
AKA attributes of employee are inherited BY hourly-emp

Contract-emp ISA Employee.

Employee is super-class.
Hourly-Emp and Contract-Emp are sub-classes.

21
Q

Generalization

A

Identifying common characteristics of a collection of entity sets and creating a new entity set with those characteristics.

For example, you notice that hourly and salaried employees are both employees, so you create a NEW entity set called Employee.
These sets were generalized to ‘Employee’
Subclasses defined first, then superclass.

22
Q

Specialization

A

Superclass defined first, then subclasses.
You define ‘student’ first, in general, then you define grad, undergrad, and phd (the specialities)
Student specialized into grad, undergrad, and phd.

23
Q
A