Database Management Systems (DBMS) Unit-I BCA Semester III
1
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
Unit-I: Introduction to Database
Introduction to Database
• A database is an organised collection of data that can be easily accessed, managed, and
updated.
• Instead of storing information in separate files, a database keeps all data in a structured
form so that it can be used efficiently by different applications.
• Databases are widely used in almost every field such as banking, education, business,
hospitals, and government services.
Database System Applications
Database systems are used in various real-life applications, such as:
• Banking: Storing customer details, account information, and transaction records.
• Airline and Railway Reservations: Managing booking details, schedules, and
passenger information.
• Education: Student records, exam results, attendance management.
• E-commerce: Product details, orders, payments, and customer information.
• Hospitals: Patient records, doctor schedules, billing, and prescriptions.
• Government: Aadhaar data, tax records, land records, etc.
These applications use database systems because they allow fast, secure, and accurate
handling of large amounts of data.
Characteristics of the Database Approach
1. Data is stored in a central place
All related data is stored together instead of scattered across multiple files.
2. Reduced data redundancy
Duplicate data is minimised because the same information is not stored repeatedly.
3. Better data sharing
Multiple users and applications can access the same data at the same time.
4. Improved data security
Access permissions can be given to authorised users only.
5. Data consistency and integrity
Since data is centralised, it remains accurate and consistent across the system.
Database Management Systems (DBMS) Unit-I BCA Semester III
2
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
6. Easy data access
Using database languages such as SQL, data can be retrieved and updated easily.
Purpose of the Database Approach
• To manage large volumes of data efficiently
Databases help in storing huge amounts of data in an organised manner.
• To allow safe multi-user access
Many users can work on the same data without affecting each other.
• To ensure data security
Sensitive data can be protected using authentication and permissions.
• To maintain accuracy and consistency
The database system automatically checks rules so that incorrect data is not stored.
• To reduce duplication and save storage
Since data is not repeated unnecessarily, storage is used more effectively.
• To support easy data retrieval and reporting
Complex queries and reports can be generated quickly.
People Associated with a Database System
A database system is used and managed by different types of people. Each group has specific
roles and responsibilities to ensure that the database works smoothly, securely, and efficiently.
The main people associated with a database system are:
Database Management Systems (DBMS) Unit-I BCA Semester III
3
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
1. Database Administrator (DBA)
• The DBA is responsible for the overall management of the database system.
• Duties include installing the DBMS, creating databases, setting user permissions,
ensuring security, taking backups, and monitoring performance.
• They make sure that the database runs without errors and remains available to users.
2. Database Designers
• These people design the structure of the database before it is created.
• They identify what data needs to be stored, how the data should be organised, and
what relationships should exist between different data items.
• They decide the tables, attributes, keys, and constraints.
3. Application Programmers / Developers
• They write programs and applications that interact with the database.
• They use languages like Java, Python, PHP, or SQL to create forms, screens, reports,
and interfaces used by end users.
• Their programs help users add, update, delete, or retrieve data.
4. End Users
End users are the people who actually use the database through applications. They are of
different types:
a) Casual Users
• Use the database occasionally.
• Write simple queries to access information.
• Example: A manager checking monthly sales.
b) Naïve Users / Parametric Users
• Use pre-defined forms or commands.
• Do not know how the database works internally.
• Example: A bank clerk entering deposits or withdrawals in a system.
c) Sophisticated Users
• Write complex queries and use advanced tools to analyse the database.
• Example: Data scientists, analysts.
d) Stand-alone Users
Database Management Systems (DBMS) Unit-I BCA Semester III
4
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
• Use ready-made applications (like MS Access) to manage their own personal data.
5. System Analysts
• Study the requirements of an organisation and decide what kind of database
applications are needed.
• They communicate between end users and developers.
6. Database System Developers
• They design and develop the DBMS software itself like Oracle, MySQL, SQL Server,
etc.
• Their role is more technical and requires deep knowledge of database theory and
system programming.
Data Models, Database Schema, Database Architecture, Data Independence,
Database Languages
1. Data Models
A data model is a way to describe how data is organised, stored, and related inside a
database.
It provides a framework to understand the structure of the data.
Types of Data Models
a) Hierarchical Model
• Data is arranged in a tree-like structure (parent–child).
• Easy to understand but not flexible.
b) Network Model
• Data is represented as a graph (many-to-many relationships).
• More flexible than hierarchical.
Database Management Systems (DBMS) Unit-I BCA Semester III
5
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
c) Relational Model
• Data is stored in tables (rows and columns).
• Most widely used model (e.g., MySQL, Oracle, SQL Server).
d) Object-Oriented Model
• Data is stored as objects (similar to real-world entities).
• Used in advanced applications.
Database Management Systems (DBMS) Unit-I BCA Semester III
6
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
e) Entity-Relationship (ER) Model
• Uses entities, attributes, and relationships.
• Mostly used during database design.
2. Database Schema
A database schema is the complete logical structure of the database.
It describes how the data is organised and how different tables are related.
• It includes tables, fields, data types, relationships, and constraints.
• Schema acts like a blueprint or plan of the database.
Types of Schemas
• Physical Schema: How data is actually stored on the storage devices.
• Logical Schema: Structure of data at a logical level (tables, relationships).
• External Schema: Different user views of the same database.
Database Management Systems (DBMS) Unit-I BCA Semester III
7
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
3. Database Architecture
Database architecture describes the structure or framework that shows how the database
system works.
The most common architecture is the Three-Level Architecture
a) External Level (View Level)
• Shows how individual users see the data.
• Each user gets a customised view.
b) Conceptual Level (Logical Level)
• Shows the complete logical structure of the database.
• Contains all entities, relationships, and constraints.
c) Internal Level (Physical Level)
• Shows how the data is physically stored (files, indexes, storage paths).
Database Management Systems (DBMS) Unit-I BCA Semester III
8
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
4. Data Independence
Data independence means that changes in one level of the database architecture do not affect
other levels. This makes the system flexible and easy to maintain.
Types of Data Independence
a) Logical Data Independence
• Ability to change the logical schema (like adding a new table) without affecting user
views.
b) Physical Data Independence
• Ability to change the physical storage (like changing file structure) without affecting
the logical schema.
5. Database Languages
Database languages are used to define, manipulate, and control data in a DBMS.
Database Management Systems (DBMS) Unit-I BCA Semester III
9
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
a) DDL – Data Definition Language
Used to define the structure of the database.
Commands: CREATE, ALTER, DROP, TRUNCATE
b) DML – Data Manipulation Language
Used to access and modify data.
Commands: INSERT, UPDATE, DELETE, SELECT
c) DCL – Data Control Language
Used to control access and permissions.
Commands: GRANT, REVOKE
d) TCL – Transaction Control Language
Used to manage database transactions.
Commands: COMMIT, ROLLBACK, SAVEPOINT
E–R Model (Entity–Relationship Model)
• The Entity–Relationship (E–R) Model is a high-level data modelling technique used
to design the logical structure of a database.
• It helps us understand how data is organised and how different data items are related
before the actual database is created.
• The E–R model is represented using E–R diagrams, which contain entities, attributes,
and relationships.
Database Management Systems (DBMS) Unit-I BCA Semester III
10
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
E–R Model Concepts
1. Entity
An entity is any real-world object or thing about which we want to store information in the
database.
Examples:
• Student, Teacher, Course, Employee, Department, Product, Hospital, Patient.
Entities are usually nouns.
2. Entity Types
An entity type is a collection or category of entities that have the same properties.
Example:
• The entity Student is an entity type.
• All individual students (Rahul, Priya, Akash) are entities belonging to this entity type.
An entity type defines a set of attributes that describe its characteristics.
3. Entity Set
An entity set is a group of similar entities that belong to the same entity type.
Example:
• All students in a college form a Student entity set.
• All employees in a company form an Employee entity set.
Entity sets are usually represented by rectangles in E–R diagrams.
4. Attributes
Attributes are the properties or characteristics that describe an entity.
Example (for a Student entity):
• Student_ID
• Name
• Age
• Address
Database Management Systems (DBMS) Unit-I BCA Semester III
11
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
• Phone_Number
• Department
Types of Attributes
a) Simple Attribute
Cannot be divided into smaller parts.
Example: Age, Salary.
b) Composite Attribute
Can be divided into sub-parts.
Example: Address → House No, Street, City, PIN.
c) Single-Valued Attribute
Has only one value for a given entity.
Example: Aadhaar Number, Roll Number.
d) Multi-Valued Attribute
Can have more than one value.
Example: Phone Numbers, Email IDs.
e) Key Attribute
Uniquely identifies an entity in an entity set.
Example: Employee_ID, Student_ID.
f) Derived Attribute
Value can be derived from another attribute.
Example: Age can be derived from Date_of_Birth.
Relationships Between Entities
A relationship is an association between two or more entities.
Example:
• A Student enrolls in a Course.
• An Employee works in a Department.
Relationships are represented using diamonds in ER diagrams.
Database Management Systems (DBMS) Unit-I BCA Semester III
12
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
Relationship Types (Degree of Relationship)
a) Unary Relationship (1-entity)
Relationship among entities of the same type.
Example: An Employee manages another Employee.
b) Binary Relationship (2-entities) — most common
Example: Student enrolls in Course.
c) Ternary Relationship (3-entities)
Example: Doctor treats Patient using Medicine.
Structural Constraints
Structural constraints define how many entities can participate in a relationship.
They include cardinality and participation.
Database Management Systems (DBMS) Unit-I BCA Semester III
13
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
a) Cardinality Ratio
Specifies the number of entities that can be associated.
1. One-to-One (1:1)
Example:
• A person has one passport.
• One passport belongs to one person.
2. One-to-Many (1:N)
Example:
• One department has many employees.
• Each employee belongs to one department.
3. Many-to-One (N:1)
Example:
• Many students belong to one class.
4. Many-to-Many (M:N)
Example:
• Students enroll in many courses.
• Each course has many students.
Participation Constraints
Database Management Systems (DBMS) Unit-I BCA Semester III
14
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
1. Total Participation
Every entity must participate in the relationship.
Example:
• Every Employee must belong to a Department.
Represented by double line.
2. Partial Participation
Some entities may or may not participate.
Example:
• Not every employee manages a project.
Represented by single line.
Weak Entity Types
A weak entity:
• Cannot be uniquely identified by its own attributes.
• Depends on another entity (called owner or strong entity).
• Identified by a partial key.
• Represented using double rectangle.
Database Management Systems (DBMS) Unit-I BCA Semester III
15
Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432
For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca
Example:
• Dependent depends on Employee.
Dependent entity may have:
• Partial key: Dependent_Name
• Attributes: Age, Relationship
Weak entity must have total participation with the owner entity.
E–R Diagram – Examples
Example 1: Student–Course ER Diagram (M:N relationship)
Example 2: Employee–Department (1:N relationship)
*** ** ***

UNIT-I Introduction to Database(DBMS) BCA SEM-III

  • 1.
    Database Management Systems(DBMS) Unit-I BCA Semester III 1 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca Unit-I: Introduction to Database Introduction to Database • A database is an organised collection of data that can be easily accessed, managed, and updated. • Instead of storing information in separate files, a database keeps all data in a structured form so that it can be used efficiently by different applications. • Databases are widely used in almost every field such as banking, education, business, hospitals, and government services. Database System Applications Database systems are used in various real-life applications, such as: • Banking: Storing customer details, account information, and transaction records. • Airline and Railway Reservations: Managing booking details, schedules, and passenger information. • Education: Student records, exam results, attendance management. • E-commerce: Product details, orders, payments, and customer information. • Hospitals: Patient records, doctor schedules, billing, and prescriptions. • Government: Aadhaar data, tax records, land records, etc. These applications use database systems because they allow fast, secure, and accurate handling of large amounts of data. Characteristics of the Database Approach 1. Data is stored in a central place All related data is stored together instead of scattered across multiple files. 2. Reduced data redundancy Duplicate data is minimised because the same information is not stored repeatedly. 3. Better data sharing Multiple users and applications can access the same data at the same time. 4. Improved data security Access permissions can be given to authorised users only. 5. Data consistency and integrity Since data is centralised, it remains accurate and consistent across the system.
  • 2.
    Database Management Systems(DBMS) Unit-I BCA Semester III 2 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca 6. Easy data access Using database languages such as SQL, data can be retrieved and updated easily. Purpose of the Database Approach • To manage large volumes of data efficiently Databases help in storing huge amounts of data in an organised manner. • To allow safe multi-user access Many users can work on the same data without affecting each other. • To ensure data security Sensitive data can be protected using authentication and permissions. • To maintain accuracy and consistency The database system automatically checks rules so that incorrect data is not stored. • To reduce duplication and save storage Since data is not repeated unnecessarily, storage is used more effectively. • To support easy data retrieval and reporting Complex queries and reports can be generated quickly. People Associated with a Database System A database system is used and managed by different types of people. Each group has specific roles and responsibilities to ensure that the database works smoothly, securely, and efficiently. The main people associated with a database system are:
  • 3.
    Database Management Systems(DBMS) Unit-I BCA Semester III 3 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca 1. Database Administrator (DBA) • The DBA is responsible for the overall management of the database system. • Duties include installing the DBMS, creating databases, setting user permissions, ensuring security, taking backups, and monitoring performance. • They make sure that the database runs without errors and remains available to users. 2. Database Designers • These people design the structure of the database before it is created. • They identify what data needs to be stored, how the data should be organised, and what relationships should exist between different data items. • They decide the tables, attributes, keys, and constraints. 3. Application Programmers / Developers • They write programs and applications that interact with the database. • They use languages like Java, Python, PHP, or SQL to create forms, screens, reports, and interfaces used by end users. • Their programs help users add, update, delete, or retrieve data. 4. End Users End users are the people who actually use the database through applications. They are of different types: a) Casual Users • Use the database occasionally. • Write simple queries to access information. • Example: A manager checking monthly sales. b) Naïve Users / Parametric Users • Use pre-defined forms or commands. • Do not know how the database works internally. • Example: A bank clerk entering deposits or withdrawals in a system. c) Sophisticated Users • Write complex queries and use advanced tools to analyse the database. • Example: Data scientists, analysts. d) Stand-alone Users
  • 4.
    Database Management Systems(DBMS) Unit-I BCA Semester III 4 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca • Use ready-made applications (like MS Access) to manage their own personal data. 5. System Analysts • Study the requirements of an organisation and decide what kind of database applications are needed. • They communicate between end users and developers. 6. Database System Developers • They design and develop the DBMS software itself like Oracle, MySQL, SQL Server, etc. • Their role is more technical and requires deep knowledge of database theory and system programming. Data Models, Database Schema, Database Architecture, Data Independence, Database Languages 1. Data Models A data model is a way to describe how data is organised, stored, and related inside a database. It provides a framework to understand the structure of the data. Types of Data Models a) Hierarchical Model • Data is arranged in a tree-like structure (parent–child). • Easy to understand but not flexible. b) Network Model • Data is represented as a graph (many-to-many relationships). • More flexible than hierarchical.
  • 5.
    Database Management Systems(DBMS) Unit-I BCA Semester III 5 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca c) Relational Model • Data is stored in tables (rows and columns). • Most widely used model (e.g., MySQL, Oracle, SQL Server). d) Object-Oriented Model • Data is stored as objects (similar to real-world entities). • Used in advanced applications.
  • 6.
    Database Management Systems(DBMS) Unit-I BCA Semester III 6 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca e) Entity-Relationship (ER) Model • Uses entities, attributes, and relationships. • Mostly used during database design. 2. Database Schema A database schema is the complete logical structure of the database. It describes how the data is organised and how different tables are related. • It includes tables, fields, data types, relationships, and constraints. • Schema acts like a blueprint or plan of the database. Types of Schemas • Physical Schema: How data is actually stored on the storage devices. • Logical Schema: Structure of data at a logical level (tables, relationships). • External Schema: Different user views of the same database.
  • 7.
    Database Management Systems(DBMS) Unit-I BCA Semester III 7 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca 3. Database Architecture Database architecture describes the structure or framework that shows how the database system works. The most common architecture is the Three-Level Architecture a) External Level (View Level) • Shows how individual users see the data. • Each user gets a customised view. b) Conceptual Level (Logical Level) • Shows the complete logical structure of the database. • Contains all entities, relationships, and constraints. c) Internal Level (Physical Level) • Shows how the data is physically stored (files, indexes, storage paths).
  • 8.
    Database Management Systems(DBMS) Unit-I BCA Semester III 8 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca 4. Data Independence Data independence means that changes in one level of the database architecture do not affect other levels. This makes the system flexible and easy to maintain. Types of Data Independence a) Logical Data Independence • Ability to change the logical schema (like adding a new table) without affecting user views. b) Physical Data Independence • Ability to change the physical storage (like changing file structure) without affecting the logical schema. 5. Database Languages Database languages are used to define, manipulate, and control data in a DBMS.
  • 9.
    Database Management Systems(DBMS) Unit-I BCA Semester III 9 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca a) DDL – Data Definition Language Used to define the structure of the database. Commands: CREATE, ALTER, DROP, TRUNCATE b) DML – Data Manipulation Language Used to access and modify data. Commands: INSERT, UPDATE, DELETE, SELECT c) DCL – Data Control Language Used to control access and permissions. Commands: GRANT, REVOKE d) TCL – Transaction Control Language Used to manage database transactions. Commands: COMMIT, ROLLBACK, SAVEPOINT E–R Model (Entity–Relationship Model) • The Entity–Relationship (E–R) Model is a high-level data modelling technique used to design the logical structure of a database. • It helps us understand how data is organised and how different data items are related before the actual database is created. • The E–R model is represented using E–R diagrams, which contain entities, attributes, and relationships.
  • 10.
    Database Management Systems(DBMS) Unit-I BCA Semester III 10 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca E–R Model Concepts 1. Entity An entity is any real-world object or thing about which we want to store information in the database. Examples: • Student, Teacher, Course, Employee, Department, Product, Hospital, Patient. Entities are usually nouns. 2. Entity Types An entity type is a collection or category of entities that have the same properties. Example: • The entity Student is an entity type. • All individual students (Rahul, Priya, Akash) are entities belonging to this entity type. An entity type defines a set of attributes that describe its characteristics. 3. Entity Set An entity set is a group of similar entities that belong to the same entity type. Example: • All students in a college form a Student entity set. • All employees in a company form an Employee entity set. Entity sets are usually represented by rectangles in E–R diagrams. 4. Attributes Attributes are the properties or characteristics that describe an entity. Example (for a Student entity): • Student_ID • Name • Age • Address
  • 11.
    Database Management Systems(DBMS) Unit-I BCA Semester III 11 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca • Phone_Number • Department Types of Attributes a) Simple Attribute Cannot be divided into smaller parts. Example: Age, Salary. b) Composite Attribute Can be divided into sub-parts. Example: Address → House No, Street, City, PIN. c) Single-Valued Attribute Has only one value for a given entity. Example: Aadhaar Number, Roll Number. d) Multi-Valued Attribute Can have more than one value. Example: Phone Numbers, Email IDs. e) Key Attribute Uniquely identifies an entity in an entity set. Example: Employee_ID, Student_ID. f) Derived Attribute Value can be derived from another attribute. Example: Age can be derived from Date_of_Birth. Relationships Between Entities A relationship is an association between two or more entities. Example: • A Student enrolls in a Course. • An Employee works in a Department. Relationships are represented using diamonds in ER diagrams.
  • 12.
    Database Management Systems(DBMS) Unit-I BCA Semester III 12 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca Relationship Types (Degree of Relationship) a) Unary Relationship (1-entity) Relationship among entities of the same type. Example: An Employee manages another Employee. b) Binary Relationship (2-entities) — most common Example: Student enrolls in Course. c) Ternary Relationship (3-entities) Example: Doctor treats Patient using Medicine. Structural Constraints Structural constraints define how many entities can participate in a relationship. They include cardinality and participation.
  • 13.
    Database Management Systems(DBMS) Unit-I BCA Semester III 13 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca a) Cardinality Ratio Specifies the number of entities that can be associated. 1. One-to-One (1:1) Example: • A person has one passport. • One passport belongs to one person. 2. One-to-Many (1:N) Example: • One department has many employees. • Each employee belongs to one department. 3. Many-to-One (N:1) Example: • Many students belong to one class. 4. Many-to-Many (M:N) Example: • Students enroll in many courses. • Each course has many students. Participation Constraints
  • 14.
    Database Management Systems(DBMS) Unit-I BCA Semester III 14 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca 1. Total Participation Every entity must participate in the relationship. Example: • Every Employee must belong to a Department. Represented by double line. 2. Partial Participation Some entities may or may not participate. Example: • Not every employee manages a project. Represented by single line. Weak Entity Types A weak entity: • Cannot be uniquely identified by its own attributes. • Depends on another entity (called owner or strong entity). • Identified by a partial key. • Represented using double rectangle.
  • 15.
    Database Management Systems(DBMS) Unit-I BCA Semester III 15 Notes by Dr. Chandrakantha T S, Vagdevi College of BCA, Melinakuruvalli, Thirthahalli-577 432 For more notes and resources, visit: https://sites.google.com/view/chandrakanthats/bca Example: • Dependent depends on Employee. Dependent entity may have: • Partial key: Dependent_Name • Attributes: Age, Relationship Weak entity must have total participation with the owner entity. E–R Diagram – Examples Example 1: Student–Course ER Diagram (M:N relationship) Example 2: Employee–Department (1:N relationship) *** ** ***