A database is a structured system used to store, organize, and manage data electronically so it can be easily accessed, updated, and analyzed.

Data is stored in tables, and tables can be related to each other.
Each table:
You might have:
Users Table
| id | name | email | | – | —- | —– |
Orders Table
| id | user_id | product | | – | ——- | ——- |
Here:
user_id connects Orders to Users.
NoSQL databases do not rely on fixed tables like relational databases.
Instead, they store data in formats like:
Instead of splitting user and orders into separate tables, you might store:
[
{
"name": "John",
"orders": [
{ "product": "Laptop" },
{ "product": "Phone" }
]
},
{
"name": "Alice",
"orders": [
{ "product": "Tablet" },
{ "product": "Headphones" }
]
}
]
| Term | Meaning |
|---|---|
| Table | A collection of related data |
| Row | One record |
| Column | One field (attribute) |
| Primary Key | Unique ID for each row |
| Foreign Key | Links between tables |
| Query | A request for data |
SQL = Structured Query Language
It is the language used to interact with relational databases.
There are four main types of SQL operations (CRUD):
INSERTSELECTUPDATEDELETESELECT * FROM students; --select all columns of student table
INSERT INTO students (name, age) VALUES ('Alice', 20); --insert value into the students table
UPDATE students SET age = 21 WHERE id = 1; --update age value whose id is 1
DELETE FROM students WHERE id = 1; --delete a row whose id is 1
Great 👍 let’s go deeper into each core concept so you truly understand how databases work — not just definitions, but how they behave in real systems.




A table is a structured collection of related data stored in rows and columns.
Think of it like:
A students table might store:
| id | name | age | email | | – | —- | — | —– |
A row represents one complete entry in a table.
From the students table:
| id | name | age | |
|---|---|---|---|
| 1 | John | 20 | john@email.com |
That entire line is one row.
A column defines what type of data is stored.
In the students table:
id → numbername → textage → numberemail → textExample:
A primary key is a column (or combination of columns) that uniquely identifies each row.
Example:
| id | name |
|---|---|
| 1 | John |
| 2 | Alice |
Here, id is the primary key.
Without primary keys, your database becomes messy and unreliable.



A foreign key is a column in one table that refers to the primary key in another table.
Users Table
| id | name |
|---|---|
| 1 | John |
Orders Table
| id | user_id | product |
|---|---|---|
| 1 | 1 | Laptop |
Here:
users.id → Primary Keyorders.user_id → Foreign KeyWithout foreign keys, you could create an order for a user that doesn’t exist.
A query is a request sent to the database.
You use queries to:
SELECT * FROM students;
This asks: 👉 “Give me all students.”
Together, these are called CRUD operations.
The blueprint of the database. It defines:
Improves search speed.
Without index:
With index:
Rules applied to columns.
Examples:
Constraints protect your data.