DBMS
DBMS
● A DBMS catalog stores the description of the database, including its data structures, types, and
constraints.
● This description is called metadata, which helps the DBMS handle different database
applications efficiently.
● The DBMS separates the data from the programs that access it.
● This allows changes in the data structure without modifying the application programs.
● The DBMS hides storage details and provides users with a simplified view of the data.
● Programs interact with data models rather than the physical data storage.
● Responsibilities include:
○ Granting access to authorized users.
○ Monitoring and optimizing database performance.
○ Ensuring data security and preventing unauthorized access.
○ Handling system failures and recovery.
● Responsible for identifying the data to be stored and defining its structure.
● They interact with end users to understand their data requirements.
● Create database models and define relationships between data entities.
● Develop multiple user views and integrate them into a unified design.
Example: A designer at an e-commerce platform defines product, customer, and order tables.
● Individuals who access the database for querying, updating, and generating reports.
○ Stand-alone Users:
■ Use pre-built software with GUI interfaces to manage small databases.
■ Example: Small business owners using accounting software.
● System analysts understand user requirements and develop standard database operations.
● Example:
○ A student database in a college contains tables for:
■ Student details (name, roll number, course)
■ Course details (course ID, name, credits)
■ Faculty details (name, department, contact)
● Entity:
An entity is an object or concept in the real world that can have data stored about it. It can be a physical
object or a conceptual object.
● Example:
○ In a college database:
■ Student → Entity with attributes like roll number, name, and age.
■ Course → Entity with attributes like course ID and course name.
● Cardinality Ratio:
Cardinality ratio defines the number of entities in one entity set that can be associated with entities in
another set. It represents the relationship between two entities.
○ Many-to-Many (M:N) → Multiple entities in both sets are related to each other.
■ Example: Students ↔ Courses (students can enroll in many courses, and
courses can have many students).
● Degree of Relationship:
● The degree of relationship refers to the number of entity types involved in a relationship.
● Types:
● Weak Entity
A weak entity is an entity that cannot exist independently. It depends on a strong entity for its
existence.
It does not have a primary key and uses a foreign key from the strong entity for identification.
Represented by a double rectangle in ER diagrams.
● Example:
○ Dependent is a weak entity, which depends on the Employee entity.
○ Dependent uses the Employee ID (foreign key) along with its own identifier (e.g.,
Dependent Name) to form a composite key.
● Strong Entity
A strong entity is an entity that can exist independently in a database. It has a primary key that
uniquely identifies its instances.
Represented by a single rectangle in ER diagrams.
● Example: Employee → It has its own primary key (Employee ID) and does not rely on any other
entity for identification.
● Schema
● Types of Schema:
○ Physical Schema: Defines how data is stored (storage format, indexing).
○ Logical Schema: Describes the database structure (tables, attributes, keys).
● Example:
● Instances
● An instance refers to the actual data stored in a database at a specific moment in time.
● It represents the state of the database.
● Example: For the Student table:
Roll_no Name Age
101 Ravi 20
102 Priya 22
The above rows represent instances of the Student table at that moment.
● DB Languages
Database languages are used to define, manipulate, and access data in a DBMS.
Types of DB Languages:
● DB Interfaces
● Types of DB Interfaces:
○ Graphical User Interface (GUI):
■ Provides a visual way to interact with the database.
■ Example: phpMyAdmin, MySQL Workbench.
○ Command-Line Interface (CLI):
■ Interact with the database using SQL commands.
■ Example: MySQL, PostgreSQL CLI.
○ Application Programming Interface (API):
■ Allows interaction between applications and the database.
■ Example: JDBC, ODBC.
● Structural Constraints
○ Participation Constraint:
■ Specifies whether all or only some instances of an entity participate in the
relationship.
■ Total participation: All instances participate.
■ Partial participation: Some instances participate.
Weak entity types refer to entity sets that rely on a strong entity for identification.
They have a partial key that combines with the primary key of the strong entity to form a composite key.
● Example:
○ Dependent (weak entity) → Depends on Employee (strong entity).
○ The composite key: Employee_ID + Dependent_Name.
Strong entity types are independent and have their own primary key. They do not require
another entity for identification.
● Example:
● It allows easy interaction with data using high-level tools like SQL.
● It reduces data redundancy by minimizing duplication and improving storage efficiency.
● It ensures data consistency through concurrency control mechanisms.
● It enhances security by restricting unauthorized access.
● It provides efficient query processing using indexing and optimized storage structures.
● It offers backup and recovery services to prevent data loss during failures.
● It supports multiple user interfaces, making it flexible for different user types.
5. Data Models
Data models define how data is stored, connected, accessed, and updated in a database management
system. They describe the database structure, operations for manipulating data, and constraints to
maintain data integrity.
● A schema diagram is a visual representation of the database schema, displaying the tables,
fields, and relationships.
Example:
In a student database, the schema defines the tables (e.g., Students, Courses) along with the fields (e.g.,
Student_ID, Name, Age) and their data types (e.g., integer, varchar).
● The initial database state is the state of the database when it is first loaded into the system.
● A valid state is a state that satisfies all the constraints defined by the schema.
Example:
If the Students table contains three rows with the details of three students, the current state of the
database consists of these records. When a new student is added, the state changes.
1. Internal Schema:
The internal schema defines the physical storage structure of the database. It describes how the data is
actually stored on the disk, including access paths, indexes, and storage blocks.
● It uses a physical data model and specifies the format and organization of data at the lowest
level.
● The internal schema is invisible to end users.
Example:
In a student database, the internal schema defines how the Student_ID and Name are stored in memory
blocks and how indexing improves the search performance.
2. Conceptual Schema:
The conceptual schema defines the logical structure of the entire database. It represents the data
model, tables, relationships, constraints, and rules.
● It provides a global view of the database that is shared by the entire organization.
● The conceptual level is also called the logical level.
● Database administrators and programmers primarily interact with this schema.
Example:
In a student database, the conceptual schema specifies the tables (Students, Courses), attributes
(Student_ID, Name, Age), and the relationships between them.
3. External Schema:
The external schema represents the user-specific view of the database. Different users or groups may
have different external schemas based on their requirements.
● It defines subschemas that describe the portion of the database relevant to a particular user group.
● It hides the remaining database from that user group, ensuring data security and privacy.
Example:
In a student database:
4. Schema Mappings:
● Mappings between the three levels transform user requests into physical operations.
● When a user queries the database, the DBMS maps the external schema to the internal schema.
● The results are reformatted to match the user’s view (e.g., displaying SQL query results on a
webpage).
8. DBMS Languages
Database Management Systems (DBMS) use specialized languages to define, manipulate, and manage
data efficiently. The main DBMS languages include:
Database Management Systems (DBMS) include various utilities that assist the Database
Administrator (DBA) in managing the database efficiently. The main utilities include:
1. Loading:
○ Used to import existing data files (e.g., text files or sequential files) into the database.
○ Automatically reformats and stores the data in the database.
○ Common loading tools include IDMS (Computer Associates), SUPRA (Cincom), and
IMAGE (HP).
2. Backup:
○ Creates a backup copy of the database by dumping the entire database onto tape.
○ Used to restore the database in case of disk failures.
○ Supports incremental backups to save space.
3. Database Storage Reorganization:
○ Rearranges database files into different file organizations.
○ Improves data retrieval performance.
4. Performance Monitoring:
○ Monitors database usage and performance.
○ Provides statistics for the DBA to make informed decisions.