ch3 Flashcards
The first step in the database design process is the requirements collection and analysis. Explain this step.
During this step, the DB designers interview prospective DB users to understand and document their data requirements. The result of this step is a concisely written set of user’ requirements. These requirements should be specified in as detailed and complete a form as possible.
In parallel with specifying the data requirements, it is useful to specify the known functional requirements of the app. These consist of user-defined ops (or transactions) that will be applied to the DB, including retrievals and updates. In software design, it is common to use DFDs, sequence diagrams, scenarios, and other techniques to specify functional requirements.
Discuss the two cases of the unknown category of NULL with the help of an example.
There are 2 cases where a value can be NULL:
- if the attribute is not applicable to a particular entity instance
- ex: an ApartmentNumber attribute is only applicable to RESIDENCE entities with Type=apartment; the ApartmentNumber attribute could be NULL for a RESIDENCE entity with Type=house
- if the attribute value is unknown; there are 2 cases:
- when you know that a value for the attribute for an entity instance exists, but you do not know what that value is
- ** ex: a PERSON entity that has the DateOfBirth attribute as NULL
- when you do not know whether a value for the attribute for an entity instance exists or not
- ** ex: a PERSON entity that has the CHILDREN attribute as NULL
Define: entity
a thing or object in the real world with an independent existence; can be an object with a physical existence or an object with a conceptual existence
Define: attribute
the particular properties that describe an entity
Define: attribute value
the value of an attribute for a particular entity
Define: relationship instance
each relationship instance in a relationship type is an association of entities, where the association includes exactly one entity from each participating entity type;
each relationship instance represents the fact that the entities participating in it are related in some way in the corresponding miniworld situation
Define: composite attribute
a composite attribute is an attribute that’s composed of multiple simpler attributes; useful in cases where you sometimes refer to the entire attribute and sometimes refer to its simpler attributes on their own;
ex: Address: composed of simpler attributes: Number, Street, ApartmentNumber, City, State, Zip;
vs simple/atomic attributes: attributes that cannot be broken down any more
ex: State
Define: multivalued attribute
an attribute that can be composed of multiple values; shown on an ERD as a double-outlined oval
ex: the Color attribute of CAR instance like for a car dealership who has a bunch of cars in stock
vs single-valued attribute: can only contain one value for a particular entity
ex: DOB attribute for a PERSON
Define: derived attribute
an attribute whose value is derived from one or more other attributes; shown on an ERD as a dotted-outlined oval
ex: Age attributed derived from DOB attribute
vs stored attribute: attr that is stored on its own explicitly and used directly
ex: DOB attribute
Define: complex attribute
a composite and/or multivalued attribute; can be nested arbitrarily;
- represent components of a composite attribute between parentheses () and separating the values with commas;
- ex: Pet(Name, Type, DOB)
- represent multivalued attributes between braces {}
- ex: Colors{red, orange, yellow, green, blue, indigo, violet}
- ex (complex): Car(VIN, Model, Year, Colors{black, silver, white, blue, red, green})
Define: key attribute
one or more attributes whose values are distinct for each individual entity in the entity set; its values can be used to identify each entity uniquely;
ex: the Ssn attribute of a PERSON entity
Define: value set (domain)
AKA domain of values; specifies the set of values that may be assigned to that attribute for each individual entity; similar to the basic data types available in most programming languages; not specified in ERDs but can be specified in UML class diagrams; The value set provides all possible values.
power set, P(V): of a set, V, is the set of all subsets of V
Mathematically, an attribute A of entity set E whose value set is V can be defined as a function from E to the power set P(V) of V:
A: E -> P(V)
We refer to the value of attribute A for entity e as A(e).
NULL: empty set
single-valued attribute: A(e) is restricted to being a singleton set for each entity e in E;
no restriction on multi-valued attributes
For a composite attribute A, the value set V is the power set of the Cartesian product of P(V_1), P(V_2), …P(V_n), where V_1, V_2, …, V_n, are the value sets of the simple component attributes that form A:
V = P(P(V_1) x P(V_2) x … x P(V_n))
What is an entity type? What is an entity set? Explain the differences among an entity, an entity type, and an entity set?
entity type: defines a collection of entities that have the same attributes; each entity type in the DB is described by its name and attrs;
* ex: entity types: DEPARTMENT, EMPLOYEE, PROJECT, DEPENDENT
entity set: AKA entity collection; the collection of all entities of a particular entity type in the DB at any point in time
* ex: EMPLOYEE entity set = the set of all EMPLOYEE instances in the DB at a given point in time
entity: one specific instance of an entity type(?)
Explain the difference between a single-valued attribute and a multi-valued attribute.
multi-valued attribute: an attribute that can be composed of multiple values; shown on an ERD as a double-outlined oval
ex: the Color attribute of CAR instance like for a car dealership who has a bunch of cars in stock
vs single-valued attribute: can only contain one value for a particular entity
ex: DOB attribute for a PERSON
What is a relationship type? Explain the differences among a relationship instance, a relationship type, and a relationship set.
relationship type: a relationship type, R, among n entity types, E_1, E_2, …, E_n defines a set of associations among entities from these entity types
relationship instance: each relationship instance in a relationship type is an association of entities, where the association includes exactly one entity from each participating entity type;
each relationship instance represents the fact that the entities participating in it are related in some way in the corresponding miniworld situation
relationship set: a relationship set, R, is a set of relationship instances, r_i, where each r_i, associates n individual entities (e_1, e_2, …, e_n) and each entity e_j in r_i is a member of entity set E_j, 1<=k<=n.
[HM: the set of all relationship instances of a given relationship type(?)]