Explain the following terms: 1. Data Dictionary 2. Weak Entity
Answer:-
1. Data Dictionary
A data dictionary (also known as a metadata repository) is like a “catalog” for your database. It stores definitions and information about all database objects. Here’s what it typically includes:
- Table information: Names of tables and their columns
- Column details: Data types, default values, constraints (e.g., NOT NULL)
- Relationships: Which keys link tables together (primary vs. foreign keys)
- Indexes: Names and types of indexes used
- Privileges: Who can access or modify data
Why it matters:
- Helps DBAs and developers understand database structure
- Ensures consistency in naming and types
- Aids in maintenance, documentation, and impact assessment during changes
2. Weak Entity
A weak entity is an entity that cannot be uniquely identified by its own attributes alone. It depends on another entity (called its owner or parent) to ensure uniqueness.
Key Characteristics:
- Has a partial key (an attribute that identifies instances only within the context of its owner)
- Participates in an identifying relationship with its owner entity
- Often requires a composite primary key combining its partial key and the owner’s primary key
Example:
- Owner Entity:
Department
with primary keyDeptID
- Weak Entity:
Dependent
of an employee- Partial key:
DependentName
(e.g., “Alice”, “Bob”) - To uniquely identify, you need
(EmployeeID, DependentName)
- This weak entity is linked to an employee by the identifying relationship “has dependent”
- Partial key:
Term | Definition |
---|---|
Data Dictionary | A metadata repository containing table, column, key, index, and user privilege information |
Weak Entity | An entity that needs its owner’s key plus its own partial key to form a unique primary key |
3. Cardinality Ratio in DBMS
Cardinality Ratio defines the number of entities that can be associated with another entity in a relationship. It tells us how many instances of one entity relate to how many instances of another.
It is an important concept in Entity-Relationship (E-R) modeling.
Types of Cardinality Ratios:
- One-to-One (1:1)
- Definition: One entity in set A is related to at most one entity in set B, and vice versa.
- Example:
Each person has one passport, and each passport is assigned to only one person.
- One-to-Many (1:N)
- Definition: One entity in set A can be related to many entities in set B, but each entity in B is related to only one in A.
- Example:
One department has many employees, but each employee belongs to one department.
- Many-to-One (N:1)
- Definition: Many entities in set A can be related to one entity in set B.
- Example:
Many students are guided by one professor.
- Many-to-Many (M:N)
- Definition: Many entities in A can be related to many entities in B.
- Example:
Students enroll in multiple courses, and each course has many students.
Summary Table:
Type | Notation | Example |
---|---|---|
One-to-One | 1:1 | Person ↔ Passport |
One-to-Many | 1:N | Department → Employees |
Many-to-One | N:1 | Students → Professor |
Many-to-Many | M:N | Students ↔ Courses |