MySQL + SQL · Lesson 1
Introduction to Database
What is a Database?
A database is an organized collection of related data stored electronically so it can be easily accessed, managed and updated. The software that controls a database is called a DBMS (Database Management System) — for example MySQL, Oracle, PostgreSQL or MS Access.
Instead of keeping student records in paper registers or scattered Excel files, a school stores them inside a database where every record is structured into rows and columns.
Basic Parts of a Database
| Term | Meaning | Example |
|---|---|---|
| Table | A collection of related rows | students table |
| Row (Record) | One complete entry | One student's details |
| Column (Field) | One attribute of data | name, marks |
| Primary Key | Unique identifier of a row | roll_no |
A Simple Example
CREATE DATABASE school;
USE school;
CREATE TABLE students (
roll_no INT PRIMARY KEY,
name VARCHAR(60),
marks INT
);
INSERT INTO students VALUES (1, 'Aman', 88);A database "school" now holds a table "students" with one record.
Types of Databases
- Relational (RDBMS): data in tables with relationships — MySQL, Oracle.
- NoSQL: document/key-value stores — MongoDB, Redis.
- Hierarchical & Network: older tree/graph based models.
Where Databases are Used
Schools
Students, fees, results, attendance
Students, fees, results, attendance
Banks
Accounts, transactions, loans
Accounts, transactions, loans
E-commerce
Products, orders, customers
Products, orders, customers
Hospitals
Patients, doctors, appointments
Patients, doctors, appointments
Common Mistakes
- Confusing a database (the data) with a DBMS (the software).
- Thinking a single Excel sheet is a database — it lacks relationships and rules.
Summary
- A database is an organized collection of related data.
- A DBMS is the software that manages it (e.g. MySQL).
- Data is stored in tables made of rows and columns.
- Used everywhere: schools, banks, hospitals, online shopping.