Skip to content

About

All Database Management System Experiments

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

16 Commits

Folders and files

Repository files navigation

πŸ—„οΈ Database Management Systems (DBMS) β€” Lab Experiments

πŸ“š DBMS Practical Laboratory

A Complete Collection of 10 Database Management Systems Experiments

MySQL PostgreSQL SQL Experiments

GitHub Academic Status

Database Design | SQL Programming | Normalization | Transactions | Indexing | Query Optimization


Developed by Antrang Srivastava

B.Tech β€” Computer Science & Engineering (AI & ML)

Chandigarh University


πŸ“Œ About This Repository

Welcome to my Database Management Systems (DBMS) Laboratory Repository!

This repository contains 10 structured DBMS practical experiments covering fundamental and advanced concepts of relational database management systems.

The experiments demonstrate database modeling, relational schema design, SQL querying, normalization, database programming, transaction management, indexing, and query optimization.

Each experiment is organized into its own folder with SQL scripts (where applicable) and documentation.

🎯 Repository Highlights

  • βœ… 10 DBMS laboratory experiments
  • βœ… Structured SQL implementations
  • βœ… Experiment-wise documentation
  • βœ… Database design and integrity constraints
  • βœ… Joins, subqueries, views, and recursive CTEs
  • βœ… Stored procedures, triggers, and auditing
  • βœ… Database normalization up to BCNF
  • βœ… Transaction management and concurrency control
  • βœ… Indexing and query performance analysis
  • βœ… SQL query optimization techniques

πŸ‘¨β€πŸŽ“ Student Information

Field Details
Student Name Antrang Srivastava
UID 25LBCS3232
Course B.Tech β€” CSE (AI & ML)
Section AI/ML-2A
Semester 3rd Semester
Subject Database Management Systems
Subject Code 25CSH-210
University Chandigarh University

🎯 Objectives

The main objectives of these laboratory experiments are:

  1. Understand fundamental concepts of relational database management systems.
  2. Design Entity-Relationship diagrams and convert them into relational schemas.
  3. Implement database integrity constraints using SQL.
  4. Perform data retrieval and manipulation using SQL queries.
  5. Understand joins, nested queries, aggregation, and query execution plans.
  6. Create database views and recursive Common Table Expressions.
  7. Implement stored procedures, triggers, and audit logging.
  8. Apply database normalization techniques from 1NF to BCNF.
  9. Understand transactions, ACID properties, and concurrency control.
  10. Evaluate indexing strategies and optimize SQL query performance.

πŸ“š Complete Experiment Index

Exp. No. Experiment Title Key Concepts Access
01 E-Commerce ER Diagram Entities, Attributes, Relationships, Keys View
02 Relational Schema & Integrity Constraints CREATE TABLE, PK, FK, UNIQUE, CASCADE View
03 Employee–Department–Project Database SELECT, GROUP BY, HAVING, Aggregates View
04 SQL Joins, Subqueries & EXPLAIN INNER JOIN, LEFT JOIN, SELF JOIN, EXISTS View
05 SQL Views & Recursive CTE Views, Hierarchies, Recursive Queries View
06 Stored Procedures, Triggers & Audit Logging Procedures, Triggers, Transactions View
07 Database Normalization 1NF, 2NF, 3NF, BCNF, Lossless Join View
08 Banking Transactions & Concurrency Control COMMIT, ROLLBACK, SAVEPOINT, ACID View
09 Railway Booking Indexing & Performance Single Index, Composite Index, EXPLAIN ANALYZE View
10 SQL Query Optimization & Performance Analysis Indexing, Query Rewriting, EXPLAIN View

πŸ”¬ Experiment Descriptions

πŸ”Ή Experiment 01 β€” E-Commerce ER Diagram

Aim: Design an Entity-Relationship model for an E-Commerce database system.

Topics Covered:

  • Entity and attribute identification
  • Primary and foreign keys
  • Relationships and cardinality
  • ER diagram representation
  • Database modeling concepts

πŸ“‚ Explore Experiment 01


πŸ”Ή Experiment 02 β€” Relational Schema & Integrity Constraints

Aim: Convert an ER model into a relational database schema and implement integrity constraints.

Topics Covered:

  • CREATE TABLE statements
  • Primary Key and Foreign Key
  • UNIQUE and NOT NULL constraints
  • Referential integrity
  • CASCADE and SET NULL operations

πŸ“‚ Explore Experiment 02


πŸ”Ή Experiment 03 β€” Employee–Department–Project Database

Aim: Create a relational database and implement different SQL queries for retrieving and analyzing employee data.

Database: CompanyDB

Topics Covered:

  • Database and table creation
  • INSERT and SELECT operations
  • WHERE and ORDER BY
  • Aggregate functions
  • GROUP BY and HAVING
  • CASE expressions
  • Relational queries

Dataset:

  • 30 Employees
  • 5 Departments
  • 8 Projects

πŸ“‚ Explore Experiment 03


πŸ”Ή Experiment 04 β€” SQL Joins, Subqueries & EXPLAIN

Aim: Implement different SQL joins and subqueries and analyze query execution plans.

Topics Covered:

  • INNER JOIN
  • LEFT JOIN
  • SELF JOIN
  • Multi-table joins
  • Correlated subqueries
  • EXISTS
  • Set-operation alternatives
  • EXPLAIN statement

Database: CompanyDB

πŸ“‚ Explore Experiment 04


πŸ”Ή Experiment 05 β€” SQL Views & Recursive CTE

Aim: Create SQL views and implement recursive queries to analyze employee reporting relationships.

Topics Covered:

  • CREATE VIEW
  • Department salary summary
  • Employee-manager hierarchy
  • View updatability
  • Recursive Common Table Expressions
  • Reporting chains
  • Hierarchical data retrieval

Database: CompanyDB

πŸ“‚ Explore Experiment 05


πŸ”Ή Experiment 06 β€” Stored Procedures, Triggers & Audit Logging

Aim: Implement database automation and validation using stored procedures and triggers.

Topics Covered:

  • Stored procedures
  • BEFORE INSERT triggers
  • BEFORE UPDATE triggers
  • AFTER UPDATE triggers
  • Salary validation
  • Employee transfer procedures
  • Transaction handling
  • Error handling and audit logging

Database: CompanyDB

πŸ“‚ Explore Experiment 06


πŸ”Ή Experiment 07 β€” Database Normalization (1NF to BCNF)

Aim: Identify functional dependencies in a denormalized Sales table and normalize it step-by-step.

Topics Covered:

  • Functional dependencies
  • First Normal Form (1NF)
  • Second Normal Form (2NF)
  • Third Normal Form (3NF)
  • Boyce-Codd Normal Form (BCNF)
  • Lossless join verification
  • Dependency preservation checks
  • Data redundancy elimination

Database: SalesDB

πŸ“‚ Explore Experiment 07


πŸ”Ή Experiment 08 β€” Banking Transactions & Concurrency Control

Aim: Implement banking transactions using SQL transaction management commands and demonstrate concurrency behavior.

Topics Covered:

  • BEGIN and COMMIT
  • ROLLBACK
  • SAVEPOINT
  • ACID properties
  • Transaction isolation levels
  • READ COMMITTED
  • SERIALIZABLE
  • Dirty reads
  • Non-repeatable reads
  • Two-session concurrency demonstrations

DBMS: PostgreSQL

πŸ“‚ Explore Experiment 08


πŸ”Ή Experiment 09 β€” Railway Booking Indexing & Query Performance

Aim: Create a Railway Booking database containing at least 5,000 records and compare query performance before and after indexing.

Topics Covered:

  • Generation of 6,000 sample records
  • Single-column indexing
  • Composite indexing
  • EXPLAIN
  • EXPLAIN ANALYZE
  • Query execution plans
  • Full table scans
  • Index lookups
  • Leftmost-prefix principle
  • Query performance comparison

Database: RailwayDB

πŸ“‚ Explore Experiment 09


πŸ”Ή Experiment 10 β€” SQL Query Optimization & Performance Analysis

Aim: Generate a dataset of at least 10,000 rows, identify five inefficient SQL queries, analyze execution plans, and implement optimization techniques.

Topics Covered:

  • Dataset generation using recursive CTEs
  • Analysis of five SQL query cases
  • Single-column and composite indexes
  • Date-range query optimization
  • LIKE pattern optimization
  • Indexing WHERE conditions
  • Correlated subquery rewriting
  • JOIN-based optimization
  • OR versus UNION
  • EXPLAIN and EXPLAIN ANALYZE
  • Before-and-after performance comparison

Database: QueryLabDB

Dataset: 10,000 employee records

πŸ“‚ Explore Experiment 10


πŸ› οΈ Technologies & Tools Used

Technology Purpose
MySQL 8.0+ Relational database management
PostgreSQL Transactions and concurrency demonstrations
SQL Database definition, manipulation, and querying
MySQL Workbench SQL development and query execution
pgAdmin 4 PostgreSQL database administration
Visual Studio Code Code editing and organization
Git Version control
GitHub Repository hosting and documentation
Markdown Experiment documentation

πŸ“‚ Repository Structure

DBMS-Experiments/
β”‚
β”œβ”€β”€ Experiment-01/
β”‚   └── E-Commerce ER Diagram & Documentation
β”‚
β”œβ”€β”€ Experiment-02/
β”‚   └── Relational Schema & Constraints
β”‚
β”œβ”€β”€ Experiment-03/
β”‚   └── Employee-Department-Project Database
β”‚
β”œβ”€β”€ Experiment-04/
β”‚   └── SQL Joins, Subqueries & EXPLAIN
β”‚
β”œβ”€β”€ Experiment-05/
β”‚   └── SQL Views & Recursive CTE
β”‚
β”œβ”€β”€ Experiment-06/
β”‚   └── Stored Procedures, Triggers & Audit Logs
β”‚
β”œβ”€β”€ Experiment-07/
β”‚   └── Database Normalization (1NF to BCNF)
β”‚
β”œβ”€β”€ Experiment-08/
β”‚   └── Banking Transactions & Concurrency
β”‚
β”œβ”€β”€ Experiment-09/
β”‚   └── Railway Booking Indexing & Performance
β”‚
β”œβ”€β”€ Experiment-10/
β”‚   └── SQL Query Optimization
β”‚
└── README.md

Each experiment folder contains its relevant SQL scripts and documentation. Experiment 01 focuses on an ER diagram.


πŸš€ How to Run the Experiments

Step 1 β€” Clone the Repository

Open a terminal and run:

git clone https://github.com/antrang0912-dotcom/DBMS-Experiments.git

Then navigate into the project directory:

cd DBMS-Experiments

Alternatively, download the repository using Code β†’ Download ZIP on GitHub.

Step 2 β€” Set Up the Database Environment

For MySQL-based experiments:

  • Install MySQL Server 8.0 or later.
  • Open MySQL Workbench or another compatible SQL client.
  • Connect to your local MySQL server.

For Experiment 08:

  • Install PostgreSQL.
  • Open pgAdmin 4 or the PostgreSQL command-line interface.
  • Use two database sessions for concurrency demonstrations.

Step 3 β€” Execute the SQL Files

  1. Open the required experiment folder.
  2. Read its README.md for prerequisites.
  3. Open the numbered SQL scripts in your database client.
  4. Execute the scripts in the documented order.
  5. Observe the results and compare them with the expected behavior.

⚠️ Important Dependencies

Experiment Database / Prerequisite
01 ER diagram β€” No database execution required
02 EcommerceDB
03 CompanyDB
04 Requires CompanyDB from Experiment 03
05 Requires CompanyDB from Experiment 03
06 Requires CompanyDB from Experiment 03
07 SalesDB
08 PostgreSQL banking accounts table
09 RailwayDB
10 QueryLabDB

Note: Run experiments on practice databases only. Some scripts modify data, create or remove database objects, and demonstrate transactions.

Actual execution plans and query timings can vary according to the database version, available indexes, dataset, and system configuration.


🧠 Key DBMS Concepts Covered

Database Design

  • ER Modeling
  • Relational Schemas
  • Entity Relationships
  • Primary and Foreign Keys
  • Database Constraints

SQL Fundamentals

  • DDL and DML
  • SELECT Statements
  • Filtering and Sorting
  • Aggregate Functions
  • GROUP BY and HAVING

Advanced SQL

  • Joins
  • Nested and Correlated Subqueries
  • Database Views
  • Recursive CTEs
  • Stored Procedures
  • SQL Triggers

Database Integrity

  • Functional Dependencies
  • Normalization
  • Referential Integrity
  • Data Consistency
  • Audit Logging

Transaction Management

  • ACID Properties
  • COMMIT
  • ROLLBACK
  • SAVEPOINT
  • Isolation Levels
  • Concurrency Control

Performance Optimization

  • Database Indexing
  • Single-Column Indexes
  • Composite Indexes
  • Query Execution Plans
  • EXPLAIN
  • EXPLAIN ANALYZE
  • SQL Query Rewriting

πŸŽ“ Learning Outcomes

Through these experiments, the following learning outcomes are addressed:

  1. Understanding database architecture and relational database concepts.
  2. Designing and implementing database schemas.
  3. Applying integrity constraints to maintain consistency.
  4. Writing efficient SQL queries for data retrieval.
  5. Understanding joins, views, and recursive queries.
  6. Implementing database automation through stored procedures and triggers.
  7. Applying normalization to reduce redundancy.
  8. Managing database transactions safely.
  9. Understanding concurrency and transaction isolation.
  10. Analyzing indexing strategies and SQL performance.

πŸ“ˆ Repository Overview

Category Details
Total Experiments 10
Primary Language SQL
Database Systems MySQL, PostgreSQL
Coverage Beginner to Advanced DBMS
Documentation Experiment-wise README files
Application Areas E-Commerce, Company Management, Sales, Banking, Railway Booking, Employee Analytics

πŸ“ Conclusion

This repository provides a structured collection of DBMS laboratory experiments demonstrating practical applications of relational database management systems.

The experiments progress from fundamental database design and SQL operations to advanced concepts such as normalization, stored procedures, transaction management, indexing, and query optimization.

The overall objective is to strengthen practical SQL knowledge, database design skills, data integrity understanding, and database performance analysis.


πŸ‘¨β€πŸ’» Author

Antrang Srivastava

UID: 25LBCS3232

B.Tech β€” Computer Science & Engineering (AI & ML)

Section: AI/ML-2A

Chandigarh University

GitHub


⭐ Database Management Systems β€” Practical Laboratory

10 Experiments | SQL | MySQL | PostgreSQL

Developed for academic learning and practical database implementation.

About

All Database Management System Experiments

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages