DB_brainscape_flashcards
(18 cards)
What is an entity?
An entity is a person, place, object, event, or concept about which data is stored.
What is the difference between an entity type and an entity instance?
An entity type is a collection of similar entities (e.g., EMPLOYEE), while an entity instance is a single occurrence (e.g., ‘John Doe’).
What is a strong entity? Give an example.
A strong entity exists independently (e.g., EMPLOYEE). It doesn’t depend on another entity for its identity.
What is a weak entity? Give an example.
A weak entity depends on a strong entity (e.g., DEPENDENT relies on EMPLOYEE) and cannot exist without it.
What is an attribute?
An attribute is a property or characteristic of an entity or relationship (e.g., age, salary).
What is the difference between required and optional attributes?
Required attributes must have a value (e.g., EmployeeID), while optional attributes may be left blank (e.g., MiddleName).
Define simple vs composite attribute with examples.
A simple attribute holds a single value (e.g., Age), while a composite attribute consists of multiple sub-values (e.g., Address = Street + City + State).
Define single-valued vs multivalued attributes with examples.
Single-valued attributes have one value per instance (e.g., Name), while multivalued can hold multiple values (e.g., Skills).
What is a derived attribute? Give an example.
A derived attribute is calculated from other attributes (e.g., YearsEmployed derived from DateHired).
What is an identifier (key)? Give an example.
An identifier uniquely identifies instances of an entity type (e.g., EmployeeID).
What is a relationship in a database?
A relationship is a link between entities that shows how they interact (e.g., Employee works for Department).
Explain the degree of a relationship and list the types.
Degree is the number of entity types involved: unary (one), binary (two), ternary (three).
What is a binary relationship? Give an example.
A binary relationship involves two entity types (e.g., Employee works for Department).
Define cardinality constraints: one-to-one, one-to-many, many-to-many.
One-to-one: each entity relates to one other (e.g., one person has one passport). One-to-many: one entity relates to many (e.g., Department has many Employees). Many-to-many: many entities relate to many (e.g., Students enroll in many Courses).
What is an associative entity and when is it used?
An associative entity is used when a relationship has attributes, turning the relationship into an entity (e.g., Certificate links Student and Course with completion date).
What conditions must be met for an associative entity?
All relationships are many-to-many, the entity has its own meaning independent of others, and it has a unique identifier.
What is time stamping in databases and why is it used?
Time stamping tracks changes by associating timestamps with data values (e.g., PriceHistory records when each price was valid).
Give an example of how time stamping tracks data changes.
In PriceHistory, each price entry for a product has a timestamp indicating when that price was set.