A database is an organized collection of related data that can be stored, accessed, managed, and updated electronically.
In simple words:
A database is a place where we store related information in an organized way so that we can easily find and manage it.
Consider a university that stores information about its students.
The database may contain the following information:
| Student ID | Student Name | Department | Semester |
|---|---|---|---|
| 101 | Ali | Computer Science | 2 |
| 102 | Ahmed | Information Technology | 4 |
| 103 | Sara | Mathematics | 1 |
| 104 | Ayesha | English | 3 |
This information can be stored in a database.
The university can use the database to:
A database generally has the following characteristics:
Some common types of databases are:
| Database Type | Description |
|---|---|
| Relational Database | Stores data in related tables |
| Document Database | Stores data as documents |
| Key-Value Database | Stores data as key-value pairs |
| Graph Database | Stores data as nodes and relationships |
| Hierarchical Database | Organizes data in a tree-like structure |
PostgreSQL is primarily a relational database management system. It also supports features for working with JSON data.
A spreadsheet can store and organize data, but a database management system provides additional capabilities for managing large and related datasets.
| Spreadsheet | Database |
|---|---|
| Suitable for many small data tasks | Suitable for structured data management |
| Data is organized in worksheets | Data is organized using database objects |
| Basic data relationships | Supports relationships between tables |
| Limited multi-user management | Supports controlled multi-user access |
| Basic data validation | Supports constraints and integrity rules |