















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















The Relational Model organizes data in the form of tables called relations. It's the most widely used model in DBMS (Database Management System).
A. Relation (Table)
∙ A relation is a named table consisting of rows and columns. ∙ It represents an entity set — a collection of similar objects.
�� Example: A STUDENT relation (entity set) Roll_
No
101
102
103
Name e nder
Course_
ID C
C
C
Riya 20 F
Moha 2
Sneha 22 F
Explanation:
∙ Each row represents a student. ∙ Each column is an attribute of the student.
B. Tuple (Row)
∙ A tuple is a single record in a relation. ∙ It represents an individual instance of an entity.
�� Example:
∙ (101, Riya, 20, F, C101) → 1 tuple in the STUDENT table
C. Attribute (Column)
∙ An attribute is a field in a table. ∙ Each attribute has: o A name o A data type (e.g., INTEGER, VARCHAR, DATE)
�� Example:
∙ In the STUDENT relation: Roll_No, Name, Age, Gender, Course_ID are attributes.
1 | P a g e D. Domain
∙ The domain of an attribute is the set of valid values it can hold.
�� Example:
∙ Age domain: {18, 19, ..., 30} ∙ Gender domain: {Male, Female, Other}
�� If a value is outside the domain, it is invalid.
E. Entity
∙ An entity is a real-world object. ∙ An entity set is a collection of similar entities.
�� Example:
∙ A student (Riya) is an entity. ∙ The STUDENT table is the entity set.
Keys are used to uniquely identify data in a table.
A. Super Key
∙ A super key is any combination of attributes that uniquely identifies a row. ∙ It may contain extra attributes.
�� Example (STUDENT table):
∙ {Roll_No} ∙ {Roll_No, Name} ∙ {Roll_No, Name, Age} → all are super keys
B. Candidate Key
∙ A minimal super key.
3 | P a g e
In a relational database , data constraints are rules that ensure that only valid, consistent, and meaningful data is stored in the database.
Without constraints:
∙ Invalid data may enter the system (e.g., negative age, duplicate roll numbers). ∙ Relationships between data can break. ∙ Data quality and trust are compromised.
✅ What is it?
∙ A domain is the set of valid values an attribute can take. ∙ A domain constraint ensures that attribute values must be from the defined domain.
✅ Purpose:
∙ Prevents invalid or meaningless data from being entered. ∙ Ensures type compatibility , ranges, and logical values.
�� Examples:
1. Age Domain Constraint:
∙ Attribute: Age ∙ Domain: Integer values from 18 to 30 Age
25
Valid? Why?
Within domain
Out of range
"Twenty"
Invalid age
Wrong data type
✅ Only numeric values between 18–30 allowed.
4 | P a g e
2. Gender Domain Constraint:
∙ Attribute: Gender ∙ Domain: {'Male', 'Female', 'Other'}
❌ “Unknown” → not allowed.
3. Date of Birth Constraint:
∙ Attribute: DOB ∙ Domain: Valid dates only.
❌ “32/13/2023” → not a valid date format.
4. Course_ID Format Constraint (Optional by domain rules):
∙ Suppose Course_ID must be in the format "C" followed by 3 digits:
✅ C101, C ❌ 101C, COURSE1 → Invalid
�� Real-Life Analogy:
Imagine filling an online form:
∙ Age: Must be between 18 and 30 → domain constraint. ∙ Email: Must follow correct email format → domain constraint. ∙ Gender: Dropdown menu allows only M/F/Other → domain constraint.
When inserting or updating a foreign key:
∙ The DBMS checks whether the value exists in the parent table. ∙ If not, the operation fails.
Real-Life Analogy:
Let’s say:
∙ STUDENT.Course_ID is like a course registration number. ∙ COURSE.Course_ID is like an official course catalog.
If a student tries to enroll in a non-existent course , it would be rejected in a real college — just like the DBMS blocks it.
6 | P a g e
The Entity-Relationship Model (ER Model) is a conceptual model for designing a databases. This model represents the logical structure of a database, including entities, their attributes and relationships between them.
∙ Entity: An objects that is stored as data such as Student , Course or Company.
∙ Attribute: Properties that describes an entity such as StudentID , CourseName , or EmployeeEmail.
∙ Relationship: A connection between entities such as "a Student enrolls in a Course ".
Components of ER Diagram
The graphical representation of this model is called an Entity-Relation Diagram (ERD).
ER Model in Database Design Process
We typically follow the below steps for designing a database for an application.
∙ Gather the requirements (functional and data) by asking questions to the database users.
∙ Create a logical or conceptual design of the database. This is where ER model plays a role. It is the most used graphical representation of the conceptual design of a database.
∙ After this, focus on Physical Database Design (like indexing) and external design (like views)
Why Use ER Diagrams In DBMS?
∙ ER diagrams represent the E-R model in a database, making them easy to convert into relations (tables).
7 | P a g e ∙ These diagrams serve the purpose of real-world modeling of objects which makes them intently useful.
∙ Unlike technical schemas, ER diagrams require no technical knowledge of the underlying DBMS used.
∙ They visually model data and its relationships, making complex systems easier to understand.
Symbols Used in ER Model
ER Model is used to model the logical view of the system from a data perspective which consists of these symbols:
The entity type defines the structure of an entity, while individual instances of that type represent specific entities.
What is an Entity Set?
An entity refers to an individual object of an entity type, and the collection of all entities of a particular type is called an entity set. For example, E1 is an entity that belongs to the entity type "Student," and the group of all students forms the entity set.
In the ER diagram below, the entity type is represented as:
Entity Set
9 | P a g e We can represent the entity sets in an ER Diagram but we can't represent individual entities because an entity is like a row in a table, and an ER diagram shows the structure and relationships of data, not specific data entries (like rows and columns). An ER diagram is a visual representation of the data model, not the actual data itself.
Types of Entity
There are two main types of entities:
1. Strong Entity
A Strong Entity is a type of entity that has a key Attribute that can uniquely identify each
instance of the entity. A Strong Entity does not depend on any other Entity in the Schema for its identification. It has a primary key that ensures its uniqueness and is represented by a rectangle in an ER diagram.
2. Weak Entity
A Weak Entity cannot be uniquely identified by its own attributes alone. It depends on a strong entity to be identified. A weak entity is associated with an identifying entity (strong entity), which helps in its identification. A weak entity are represented by a double rectangle. The participation of weak entity types is always total. The relationship between the weak entity type and its identifying strong entity type is called identifying relationship and it is represented by a double diamond.
Example:
A company may store the information of dependents (Parents, Children, Spouse) of an Employee. But the dependents can't exist without the employee. So dependent will be a Weak Entity Type and Employee will be identifying entity type for dependent, which means it is Strong Entity Type.
Strong Entity and Weak Entity
Attributes in ER Model
Attributes are the properties that define the entity type. For example, for a Student entity Roll_No, Name, DOB, Age, Address, and Mobile_No are the attributes that define entity type Student. In ER diagram, the attribute is represented by an oval.
10 | P a g e
Attribute