A database is an organized collection of interrelated data representing some aspect of the real world, stored in a format that can be easily accessed. A DBMS (Database Management System) is the software used to create, manage, and query databases while handling security, concurrency, and recovery. Applications request data from the DBMS, and the DBMS retrieves it from storage.
- RDBMS : A Relational DBMS stores data in tables (relations) made of rows (records/tuples) and columns (attributes), with relationships between tables. Examples: MySQL, PostgreSQL, Oracle, SQL Server.
- Non-Relational (NoSQL) : Databases that do not store data in tables, such as document, key-value, and graph databases. Example: MongoDB.
- SQL vs MySQL : SQL is the language used to interact with relational databases; MySQL is one RDBMS that understands SQL. SQL keywords are not case sensitive.
Why DBMS over File Systems -
DBMSs were developed to solve the problems of storing data in plain files:
- Data redundancy and inconsistency (the same data duplicated in multiple files, going out of sync).
- Difficulty in accessing data (a new program needed for every new query).
- Data isolation (data scattered across multiple files and formats).
- Integrity problems (no central place to enforce rules like "balance cannot be negative").
- Atomicity of updates (a crash mid-update leaves data half-changed).
- No safe concurrent access by multiple users.
- Weak security (no fine-grained control over who sees what).