MySQL + SQL · Lesson 5

Database Management System (DBMS) Tutorial

What is DBMS?

DBMS (Database Management System) is a software system that enables users to define, create, maintain and control access to a database. It acts as an interface between the user/application and the actual data stored on disk.

Without DBMS, data is stored in flat files — no structure, no security, no sharing. DBMS brings order, control and intelligence to data management.

Popular DBMS Software: MySQL, Oracle Database, Microsoft SQL Server, PostgreSQL, SQLite, MongoDB (NoSQL).

Real analogy: Think of DBMS as a librarian. The library (database) has thousands of books (data). The librarian (DBMS) knows where every book is, who can take it, tracks issued books, and recovers lost books — you don't need to search the entire library yourself.

Components of DBMS

ComponentRole
HardwarePhysical devices — server, hard disk, RAM where database is stored
SoftwareThe DBMS software itself (MySQL, Oracle) + OS + application programs
DataActual data stored in tables, plus metadata (data about data — structure info)
ProceduresRules and instructions for using and managing the database
UsersDatabase Administrator (DBA), End Users, Application Programmers
Query LanguageSQL (Structured Query Language) — used to interact with database

Functions of DBMS

  • Data Definition: Creating and modifying database structure — tables, columns, constraints (using DDL: CREATE, ALTER, DROP).
  • Data Manipulation: Inserting, updating, deleting and retrieving data (using DML: INSERT, UPDATE, DELETE, SELECT).
  • Data Security: Controlling who can access what data — GRANT and REVOKE privileges.
  • Data Integrity: Enforcing constraints (PRIMARY KEY, FOREIGN KEY, CHECK) to keep data correct.
  • Concurrency Control: Allowing multiple users to work simultaneously without conflicts — using locks and transactions.
  • Backup and Recovery: Saving copies of data and restoring after failure — mysqldump, binary logs.
  • Transaction Management: Ensuring ACID properties — Atomicity, Consistency, Isolation, Durability.

Types of DBMS

TypeStructureExample
HierarchicalData organized in tree structure (parent-child). Fast but rigid — no many-to-many relationships.IBM IMS — used in old banking systems
NetworkData organized as graph — records linked with pointers. More flexible than hierarchical.IDMS — handles complex relationships
Relational (RDBMS)Data stored in tables (rows and columns). Tables linked using keys. Uses SQL.MySQL, Oracle, PostgreSQL, MS SQL Server
Object-OrientedData stored as objects (like OOP). Stores complex data types.db4o, ObjectDB
NoSQLNon-relational. Stores data as documents, key-value, graph or column stores. Handles big unstructured data.MongoDB (document), Redis (key-value), Cassandra

For Class 12 and most college courses: Focus on RDBMS — it is the most widely used and MySQL is the standard example.

What is RDBMS?

RDBMS (Relational Database Management System) is a type of DBMS where data is organized in tables (relations). Tables are linked using primary keys and foreign keys. All operations are done using SQL.
FeatureDBMSRDBMS
Data StorageFiles or tables (not necessarily related)Tables that are always related using keys
RelationshipsNot mandatoryCentral concept — foreign key links tables
NormalizationNot requiredStrongly followed (1NF, 2NF, 3NF)
Query LanguageMay varyAlways SQL
ExamplesMS Access (basic), file-based systemsMySQL, Oracle, PostgreSQL, SQL Server

SQL Demo – DBMS in Action

-- DBMS Function 1: Data Definition (DDL)
CREATE DATABASE school_db;
USE school_db;
CREATE TABLE students (
  roll_no INT PRIMARY KEY,
  name VARCHAR(80) NOT NULL,
  class_name VARCHAR(10)
);

-- DBMS Function 2: Data Manipulation (DML)
INSERT INTO students VALUES (1, 'Aarav Sharma', 'XII-A');
INSERT INTO students VALUES (2, 'Priya Verma', 'XII-B');
UPDATE students SET class_name = 'XII-C' WHERE roll_no = 2;
SELECT * FROM students;

-- DBMS Function 3: Security (DCL)
-- (Run as root user)
CREATE USER 'teacher'@'localhost' IDENTIFIED BY 'pass123';
GRANT SELECT ON school_db.students TO 'teacher'@'localhost';
-- Teacher can only SELECT — cannot INSERT/DELETE

-- DBMS Function 4: Transaction Management (TCL)
START TRANSACTION;
INSERT INTO students VALUES (3, 'Ravi Singh', 'XII-A');
-- If something goes wrong:
ROLLBACK;   -- undo the insert
-- If everything is fine:
COMMIT;     -- permanently save
SELECT * FROM students output:
+---------+--------------+------------+
| roll_no | name | class_name |
+---------+--------------+------------+
| 1 | Aarav Sharma | XII-A |
| 2 | Priya Verma | XII-C |
+---------+--------------+------------+

Common Mistakes

  • Confusing Database with DBMS: MySQL is the DBMS (software); school_db is the Database (data). They are different.
  • Thinking all DBMS are RDBMS: MongoDB is a DBMS but NOT an RDBMS. RDBMS specifically uses tables and SQL.
  • Underusing DBMS features: Using MySQL just for storage without transactions, constraints or user privileges wastes its full power.
  • No DBA role defined: Every project needs someone responsible for backup, user access and performance — even in small school projects.

Practice Tasks

  1. Draw a diagram showing DBMS components (Hardware, Software, Data, Users, Query Language) with arrows showing how they interact.
  2. Create school_db from the SQL demo. Add a teacher user with SELECT-only access. Try INSERT as teacher — observe the error.
  3. Write one example of each DBMS function (DDL, DML, DCL, TCL) using a library database.
  4. Viva Q: "What is the difference between DBMS and RDBMS?" — Write 4 differences.

Summary

  • DBMS = software to create, manage, control and access a database.
  • Components: Hardware, Software, Data, Procedures, Users, Query Language.
  • Functions: Data Definition, Manipulation, Security, Integrity, Concurrency, Backup, Transactions.
  • Types: Hierarchical, Network, Relational (RDBMS), Object-Oriented, NoSQL.
  • RDBMS is the most important — MySQL, Oracle, PostgreSQL use tables + SQL + keys.