IT 231: IT and Application (BBM)
By the end of this session, you will be able to:
A Database Management System (DBMS) is a software program that enables users to create, maintain, and control access to a database.
Think of it like a librarian for a huge library:
| Spreadsheet (Excel) | DBMS (e.g. MySQL) | |
|---|---|---|
| Size | Max 1,048,576 rows per sheet | Billions of rows |
| Many users at once | Edit conflicts, "file is locked" | Thousands at the same time, safely |
| Rules on data | Easy to type "twenty" in an Age column | Data types and constraints reject bad data |
| Security | Whole file: open or not | Permissions per table, even per column |
| Recovery | Hope you saved a copy | Automatic backups and logs |
Excel is great for analysis. A DBMS is built for shared, reliable storage.
It acts as an interface between users/applications and the physical database.
e.g., Website, Mobile App, Analyst
(The Manager)
e.g., Tables, Records, Files
The DBMS ensures data is consistently organized and easily accessible, preventing chaos.
A DBMS handles several critical tasks to manage the database effectively:
The DBMS uses a Data Definition Language (DDL) to build the database's structure.
This is how an administrator defines the "rules" for the data.
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
EnrollmentDate DATE
);
DDL is used to create tables, define fields, and set constraints.
CREATE TABLE Orders (
OrderID INT PRIMARY KEY,
Phone CHAR(10) NOT NULL,
Amount DECIMAL(10,2) CHECK (Amount > 0),
OrderDate DATE NOT NULL
);
Which of these inserts will the DBMS reject?
1. (1, '9841000000', 850.00, '2026-10-15') ✅ Accepted
2. (1, '9851000000', 500.00, '2026-10-15') ❌ OrderID 1 already exists (primary key)
3. (2, '9861000000', -200.00, '2026-10-15') ❌ The amount must be greater than 0 (CHECK)
4. (3, NULL, 300.00, '2026-10-15') ❌ The phone number can't be empty (NOT NULL)
A college keeps course registrations in one sheet:
101 | Anjali | BBM | Bachelor of Business Management | IT231 Information Technology; MG201 Principles of Management
101 | Anjali | BBM | Bachelor of Business Management | IT231 | Information Technology
101 | Anjali | BBM | Bachelor of Business Management | MG201 | Principles of Management
New problem: Anjali's name and programme now repeat on every row (redundancy).
The 1NF table's key is StudentID + CourseID.
Students(StudentID, Name, ProgrammeCode, ProgrammeName) · Courses(CourseID, Title) · Enrollments(StudentID, CourseID)Programmes(ProgrammeCode, ProgrammeName)Result: 4 small tables, each fact stored once. Renaming a course now means changing one row, not hundreds.
A Data Manipulation Language (DML) allows users to work with the data.
For relational databases, the standard DML is SQL (Structured Query Language).
-- Retrieve data
SELECT * FROM Students;
-- Insert a new record
INSERT INTO Students VALUES (...);
-- Delete a record
DELETE FROM Students WHERE StudentID=101;
Table Products(ProductID, Name, Price, Stock)
1. Show all products cheaper than Rs 1,000.SELECT * FROM Products WHERE Price < 1000;
2. Add a new product: ID 5, "Dhaka Topi", Rs 1,200, 30 in stock.INSERT INTO Products VALUES (5, 'Dhaka Topi', 1200, 30);
3. Change the price of product 2 to Rs 950.UPDATE Products SET Price = 950 WHERE ProductID = 2;
4. Remove every product that is out of stock.DELETE FROM Products WHERE Stock = 0;
⚠️ If you forget the WHERE in #3 or #4, the change applies to every row!
1 | Lokta Notebook
2 | Pashmina Shawl
1 | 1 | 3 · 2 | 2 | 1 · 3 | 1 | 2
SELECT p.Name, s.Qty FROM Sales s JOIN Products p ON s.ProductID = p.ProductID;
The manager asks: "How many of each product did we sell?" (same tables)
SELECT p.Name, SUM(s.Qty) AS TotalSold
FROM Sales s JOIN Products p ON s.ProductID = p.ProductID
GROUP BY p.Name;
GROUP BY puts rows with the same name together; SUM adds their quantities.COUNT, AVG, MIN, MAX.The DBMS acts as a security guard.
Ensures smooth operation in multi-user environments.
The college stores exam marks in a Results table. The DBA gives each group only the rights it needs.
GRANT SELECT ON Results TO student_portal;
→ The student portal can read marks (and shows each student only their own row).
GRANT SELECT, UPDATE ON Results TO exam_section;
→ The exam section can read and correct marks.
REVOKE UPDATE ON Results FROM exam_section;
→ After results are published, nobody can quietly change a mark.
Rule of thumb: least privilege. Give each user the smallest set of rights that lets them do their job.
Lesson: GRANT and REVOKE are not enough on their own. Patch quickly, and watch who is reading the data.
Hari's balance is Rs 10,000. At the same moment, two transactions run:
Reads 10,000
Writes 8,000
Reads 10,000
Writes 15,000 (overwrites A!)
Final balance: Rs 15,000. The correct answer is Rs 13,000, so the bank just lost Rs 2,000. A DBMS prevents this with locking: B must wait until A finishes.
Sending Rs 5,000 from Sita to Ram takes two steps: subtract from Sita, then add to Ram. What if the power fails in between?
A: Atomicity. Both steps happen, or neither does.
C: Consistency. The rules still hold, so the total money stays the same.
I: Isolation. Transactions running at the same time don't interfere (no lost updates).
D: Durability. Once confirmed, it survives a crash.
Every eSewa transfer or bank payment you make is a transaction.
Protects data from loss due to system failures, errors, or disasters.
The DBMS provides tools to create periodic copies (backups) of the database.
If the system crashes, the DBMS can use the backups and transaction logs to restore the database to a consistent state.
This function is absolutely critical for business continuity.
A bank takes a full backup every Sunday at midnight. The DBMS also writes every change to a transaction log.
Backup alone: lose 2½ days of payments. Backup + log: lose almost nothing.
Lesson: A backup you've never tested isn't a backup. Remember the 3-2-1 rule from Unit 4: keep 3 copies, on 2 types of media, with 1 off-site.
Lesson: changing a database system is risky. Test at full load, move in stages, and keep a way back.
The DBMS is the gatekeeper software. The DBA is the person who runs it.
Install and upgrade the DBMS, and design tables with the developers.
Create user accounts and permissions, and run and test backups.
Monitor performance, speed up slow queries, and plan storage growth.
Every Nepali bank, telecom and wallet company employs DBAs. It's a well-paid IT career.
Different systems are chosen based on cost, scale, and features.
1. A small Pokhara homestay wants a cheap booking website. → MySQL or PostgreSQL (free, open-source)
2. A large bank wants its core system with 24/7 vendor support. → Oracle or SQL Server (commercial, supported)
3. A company that already runs everything on Microsoft products. → SQL Server
4. A mobile app that must keep data on the phone while offline. → SQLite, a tiny database built into every Android and iPhone
How does a DBMS (like PostgreSQL or MySQL) power these services?
The canteen sells items (tea, samosa, chowmein) and records each student's order.
1. Which tables do you need? → Items, Orders, and OrderLines (which items, how many, in each order)
2. What is the primary key of each? → ItemID, OrderID, and OrderID + ItemID together
3. Which DBMS function stops a price of Rs −20? → Data definition: a CHECK (Price > 0) rule
4. Who may change prices? → Only the manager, using GRANT UPDATE (security and control)
5. Two cashiers sell the last samosa at the same moment. Which function helps? → Concurrency control (locking)
CREATE TABLE DDL
SELECT DML
ALTER TABLE DDL
UPDATE DML
DROP TABLE DDL
DELETE DML
Bonus: GRANT and REVOKE belong to a third group, DCL (Data Control Language), which manages who can access what.
Revise the chapter note before writing these answers.
Teaching content © Arjan KC. Third-party media remain the property of their owners.
Any questions?
Read the full note: Database Management Systems (DBMS)
Next deck: Unit 5.6: The Business-Level Advantages of Using Databases