Introduction to Database Management System
A database is an organised collection of related data. A Database Management System (DBMS) is the software that manages that data — allowing users to create, read, update, and delete information efficiently. Every organisation — from a hospital to a bank — relies on databases.
A. What is a Database & DBMS?
Definition & Purpose
What databases and DBMS are, and why they exist
| Term | Definition |
|---|---|
| Data | Raw, unorganised facts and figures. E.g. "Ali", "25", "Karachi" — meaningless alone. |
| Information | Processed, organised data that has meaning. E.g. "Ali is 25 years old and lives in Karachi." |
| Database | An organised collection of related data stored electronically so it can be easily accessed, managed, and updated. Like a digital filing system. |
| DBMS | Database Management System — software that creates, manages, and controls access to a database. Users interact with the database through the DBMS. Examples: MySQL, Oracle, MS Access, MS SQL Server, PostgreSQL. |
| Traditional files vs DBMS | Before DBMS: data stored in separate flat files — led to data redundancy (repeated data) and data inconsistency. DBMS solves both problems by storing data centrally. |
| Who uses DBMS? | Hospitals (patient records), banks (account data), schools (student records), airlines (booking systems), governments (citizen records), e-commerce (product/order data). |
Data vs Information
Data = raw unorganised facts. Information = processed meaningful data.
Database
Organised collection of related data stored electronically for easy access and management.
DBMS
Software managing the database. MySQL, Oracle, MS Access, SQL Server. Eliminates redundancy and inconsistency.
Traditional Files vs DBMS
Flat files caused data redundancy (repeated data) and inconsistency. DBMS stores data centrally — solves both problems.
Who Uses DBMS?
Hospitals (patient records) · Banks (accounts) · Schools (students) · Airlines (bookings) · E-commerce (orders)
UsersUsers and applications send requests to the DBMS
DBMSManages queries, transactions, security, and storage
DatabaseThe actual data — tables, records, fields stored on disk
B. Key Database Terms
Essential Vocabulary
The terms every DBMS exam question uses
| Term | Definition | Example |
|---|---|---|
| Table | The basic structure in a relational database — a grid of rows and columns where related data is stored. Also called a Relation. | Students table, Products table, Orders table |
| Record (Row / Tuple) | A single, complete entry in a table — all the data about one person or item. Each row = one record. | One student's complete details (name, age, roll no) |
| Field (Column / Attribute) | A single piece of information about each record. Each column stores one type of data. | Name, Age, Address, Roll Number |
| Primary Key (PK) | A field (or combination of fields) that uniquely identifies each record in a table. No two records can have the same primary key. Cannot be NULL. | Roll Number (every student has a unique roll no) |
| Foreign Key (FK) | A field in one table that references the Primary Key of another table — used to create relationships between tables. | Student_ID in the Marks table refers to the Students table |
| Query | A question or request to retrieve specific data from the database. Written in SQL (Structured Query Language). | "Show all students with marks > 60" |
| Schema | The overall logical structure/design of a database — what tables exist, their columns, data types, and relationships. | Blueprint of the entire database |
| Index | A data structure that speeds up searching/retrieval of records. Like a book's index — allows faster lookup. | Index on Name field for fast name searches |
| Data Redundancy | Storing the same data in multiple places. Problem with traditional flat files. DBMS eliminates this. | Student address stored in both Marks and Library tables |
| Data Integrity | Accuracy and consistency of data in the database. DBMS enforces rules to maintain integrity. | Age field cannot contain text; marks cannot exceed 100 |
| CRUD | The four basic database operations: Create · Read · Update · Delete | INSERT · SELECT · UPDATE · DELETE (SQL commands) |
Example: STUDENTS Table
| 🔑 Roll_No (PK) | Name | Age | City | Marks |
|---|---|---|---|---|
| 101 | Ali Hassan | 22 | Karachi | 85 |
| 102 | Sara Ahmed | 21 | Lahore | 92 |
| 103 | Bilal Khan | 23 | Quetta | 78 |
| 104 | Amna Malik | 22 | Islamabad | 95 |
🔑 Roll_No is the Primary Key — unique for every student, cannot be repeated or NULL. Each row = one Record. Each column = one Field.
Table / Relation
Grid of rows and columns storing related data. Basic unit of a relational database.
Record = Row = Tuple
One complete entry. All data about one person or item.
Field = Column = Attribute
One type of information (Name, Age, City). Each column stores one data type.
Primary Key (PK)
Uniquely identifies each record. Cannot be NULL or repeated. E.g. Roll Number.
Foreign Key (FK)
Links one table to another. References the PK of another table. Creates relationships.
Query
A request to retrieve specific data from the database. Written in SQL. E.g. "Show all students with marks > 60".
Schema
The overall logical structure/blueprint of the database — what tables exist, their columns, data types, and relationships.
Index
Data structure that speeds up searching. Like a book index — allows faster lookup without scanning every record.
Data Redundancy & Integrity
Redundancy = same data in multiple places (problem). Integrity = accuracy and consistency enforced by DBMS constraints.
CRUD
Create · Read · Update · Delete — the four basic database operations.
⚡ Exam Tips — Row = Record = Tuple. Column = Field = Attribute. Primary Key = uniquely identifies each record, cannot be NULL. Foreign Key = links two tables. Table = Relation. CRUD = Create, Read, Update, Delete. Data Redundancy = repeated data (problem of flat files).