What are the building blocks of ER?
-Entity
-Attribute
-Relationship
What is ER?
It refers to the Entity-Relationship (ER) Model.
Illustrates how real-world objects (entities) and their properties (attributes) relate to one another within a system.
What is an Entity?
It is a noun: object/thing to store (Student, Course).
What is an Attribute?
Properties (Name, Email) or characteristics of an entity.
What is a Relationship?
The association or link between two or more entities, which is often implemented using Foreign Keys.
What are the attributes types?
-Simple vs Composite
-Single-Valued vs Multivalued
-Stored vs Derived
-Optional vs Mandatory
What is the Simple vs Composite Attribute?
A simple attribute is an attribute that cannot be further subdivided into meaningful, smaller components. It holds a single, atomic (indivisible) value. Example: Gender.
A composite attribute is an attribute that can be broken down into a set of other, smaller attributes (which are often simple attributes). Example: Full Name, can be divided into First Name and Last Name.
What is the Single-Valued vs Multivalued Attribute?
A single-valued attribute is an attribute that can hold only one value for a particular entity instance. Example: Age, you can only be one age at the time.
A multivalued attribute is an attribute that can hold multiple values for a single entity instance. Example: Degree, one person can have more than 1 degree at the time.
What is a Stored vs Derived Attribute?
A stored attribute is an attribute whose values are physically stored in the database.
A derived attribute is an attribute whose values are calculated or derived from the values of other stored attributes
What is an Optional vs Mandatory Attribute?
A Mandatory Attribute (or Required Attribute) is one that must have a value in every record of an entity.
An Optional Attribute is one that may or may not have a value in a record. Can be NULL.
What is Cardinality?
Numerical relationship between rows of one table and rows of another table. It defines how many instances of one entity can relate to instances of another entity.
Types of Cardinality
-1 to 1 (1:1)
-1 to many (1:N)
-Many to many (M:N)
What is Participation?
Defines the extent to which an entity must be involved in a relationship.
Types of Participation
-Total (Mandatory)
-Optional
What is a Candidate Key?
It represents one of the potential choices that can be designated as the table’s Primary Key.
Minimal unique identifier(s).
What is a Primary Key?
Is the chosen Candidate Key, is not NULL. Unique identifier.
What is an Alternate Key?
Rest of Candidate Keys that were not chosen to be PK.
What is a Composite Key?
A key that consists of two or more attributes (columns) that are combined to uniquely identify each row in a database table.
What is a Surrogate Key?
Unique identifier that is artificially generated and added to a database table to serve as its primary key. Has no real meaning.
What is a Foreign Key?
Column or a set of columns in a database table that references the Primary Key (PK) or a Unique Key of another table. Enforces referential integrity.
What are referential actions?
Rules defined on a Foreign Key (FK) constraint that tell the database management system how to automatically maintain data consistency.