A. An entity is a piece of data that’s uniquely identifiable within the database and usually represents something from the real world.
An Entity type is a collection of entities with general characteristics.
For example, a database of a corporate company has entity types such as employees, departments, etc. In DBMS, every entity type contains a set of attributes that explain the entity.
A. An entity set is a collection of similar types of entities that share the same attributes.
For example, all students of a school are a entity set of Student entities.
A. An attribute is a property that describes the entity. For example, in a customer database, the attributes might be name, address, and phone number.
In a relational data model, it is depicted as a column.
A. Prime attributes are attributes that are part of a candidate key (Unique Key).
Non-prime attributes are attributes that are not part of any candidate key (Unique Key).
A. In database design, an entity set is a collection of entities that share common characteristics.
Entities are objects or concepts that have existence and can be described with a set of attributes or properties. There are two types of entity sets:
Characteristics | Strong Entity Set | Weak Entity Set |
---|---|---|
Unique Identifier | Yes (e.g. Employee ID) | No (relies on another entity) |
Independent Existence | Yes (can exist alone) | No (exists with another entity) |
Example | Employee (e.g. John Smith) | Order Item (e.g. Book in Order 1) |
ER Model Representation | Rectangles | Double Rectangles |
Key Attributes | Has its own primary key | Has a partial key (foreign key) |
Existence Dependency | Exists independently | Exists dependent on another entity |
Identification | Identified by its own attributes | Identified by its own and another entity’s attributes |
A. There are different types of attributes:
Table 1: | Employee ID | Name | Department | | — | — | — | | 101 | John Smith | Sales | | 102 | Jane Doe | Marketing | | 103 | Bob Johnson | IT |
Table 2: | Order ID | Customer ID | Order Date | | — | — | — | | 1 | 101 | 2022-01-01 | | 2 | 101 | 2022-01-15 | | 3 | 102 | 2022-02-01 |
Customer ID | Name | Address |
---|---|---|
101 | John Smith | 123 Main St |
102 | Jane Doe | 456 Elm St |
Table 3: | Order ID | Product ID | Quantity | | — | — | — | | 1 | 101 | 2 | | 1 | 102 | 1 | | 2 | 101 | 3 |
A. check Q9
A. Refer to:
A. University: Image
Library: Image
A. Relationship type:
Relationship set:
Degree of relationship:
Cardinality:
A. In a DBMS, a relationship is a connection between two or more entity sets that share common attributes. Relationships are used to establish links between entities and to define how they interact with each other.
There are three main types of relationships:
In a 1:1 relationship, each entity in one entity set is related to only one entity in another entity set.
Suppose we have two entity sets: Employee and Employee Details. Each employee has only one set of details, and each set of details belongs to only one employee.
Employee ID | Name | Department |
---|---|---|
101 | John Smith | Sales |
102 | Jane Doe | Marketing |
103 | Bob Johnson | IT |
Employee ID | Address | Phone Number |
---|---|---|
101 | 123 Main St | 123-456-7890 |
102 | 456 Elm St | 987-654-3210 |
103 | 789 Oak St | 555-123-4567 |
In this example, the Employee ID attribute in the Employee entity set is related to the Employee ID attribute in the Employee Details entity set. This is a 1:1 relationship because each employee has only one set of details, and each set of details belongs to only one employee.
In a 1:N relationship, each entity in one entity set is related to multiple entities in another entity set.
Suppose we have two entity sets: Customer and Order. Each customer can place multiple orders, but each order belongs to only one customer.
Customer ID | Name | Address |
---|---|---|
101 | John Smith | 123 Main St |
102 | Jane Doe | 456 Elm St |
103 | Bob Johnson | 789 Oak St |
Order ID | Customer ID | Order Date |
---|---|---|
1 | 101 | 2022-01-01 |
2 | 101 | 2022-01-15 |
3 | 102 | 2022-02-01 |
4 | 103 | 2022-03-01 |
5 | 101 | 2022-04-01 |
In this example, the Customer ID attribute in the Customer entity set is related to the Customer ID attribute in the Order entity set. This is a 1:N relationship because each customer can place multiple orders, but each order belongs to only one customer.