Learn What is Database | Types of Database | DBMS
What is a Database?
Understanding Data
- In today's digital world, data is crucial for the functioning of various entities, from governments to local businesses.
- Data encompasses any information or fact, including personal details like name, age, and address, as well as broader categories such as school statistics or technology-related information.
- Data can exist in multiple forms: images, videos, files, or plain text. All these formats can be stored in a database.
What is a Database?
- A database is defined as an electronic container that stores data within a computer system.
- The primary purpose of databases is to allow easy access, modification, protection, and analysis of stored data.
- Many applications (e.g., Google, Instagram) utilize databases to manage user data effectively.
Practical Application Example
- For instance, developing a college timesheet web application requires a database to store staff details and student attendance.
- The application connects to the database on your computer's hard drive whenever it needs to save or retrieve information.
Database vs. DBMS
- It's important to differentiate between a database (a container for data) and DBMS (Database Management System), which manages the database.
- DBMS allows users to interact with the database using specific commands; examples include MySQL and MongoDB.
Evolution of Databases
Historical Development
- The evolution of databases began in the 1960s with simple file storage systems like CSV files.
- Hierarchical and network databases followed but were limited in handling complex relationships among data.
Current Types of Databases
- Today’s popular types are relational databases (over 74% usage rate) and non-relational databases due to increased social media data demands.
- Major companies often use both types simultaneously; Oracle leads in relational databases while MongoDB dominates non-relational ones.
Relational Databases Explained
Structure of Relational Databases
- In relational databases, data is organized into tables that relate to one another through defined relationships.
Understanding Relational and Non-Relational Databases
Relational Database Structure
- The employee and manager tables are interconnected through the manager ID column, which serves as a foreign key constraint in relational databases.
- Although the employee and department tables are not directly linked, data can still be retrieved from the employee table based on conditions from the department table, showcasing how relational databases manage scattered information across multiple tables.
- SQL (Structured Query Language) is introduced as the standard programming language for querying data in relational databases, widely used by financial institutions like banks and insurance companies.
- Examples of popular relational databases include Oracle, MySQL, Microsoft SQL Server, and PostgreSQL.
Overview of Non-Relational Databases
Key-Value Store
- A key-value database is defined as the simplest form of non-relational database where each piece of data is associated with a unique key.
- This type of database is particularly useful for storing configuration data or state information that can be represented as dictionaries or hashes in programming languages. Examples include Redis and Memcached.
Document Database
- Document databases utilize unique keys to identify stored data but differ from key-value stores by organizing data into structured formats called documents (e.g., JSON or XML).
- Each document can have its own structure without adhering to a specific format across all documents, allowing for more flexible querying and analysis. Notable examples are MongoDB and CouchDB.
Graph Database
- Graph databases represent relationships between data using nodes (data points), edges (connections), and properties rather than traditional tables.
- This model is advantageous when analyzing complex relationships or patterns within datasets, such as fraud detection in financial transactions. Neo4j is an example of a graph database.
Wide Column Database