Introduction
00:00:00In today's digital landscape, data is crucial for the functioning of governments and businesses alike. A database serves as a container that stores various forms of data—ranging from personal information like names and addresses to educational details about students and teachers. The primary purpose of databases is to facilitate easy access, modification, protection, and analysis of this stored information. Many everyday applications such as Google, Instagram, WhatsApp, and Facebook rely on databases to manage their vast amounts of user data.
What is Database
00:02:26A college timesheet web application requires a database to store and retrieve data such as staff details, student attendance, and marks. The database is installed on the developer's computer, allowing the application to connect for saving or retrieving information. In larger applications like Facebook, extensive databases are used to manage vast amounts of data stored on servers. While many confuse a database with DBMS (Database Management System), they serve different purposes; the former stores data while the latter manages it through specific commands.
Evolution of Database
00:05:02The evolution of databases began in the 1960s with simple file storage systems like CSV and fixed-length files. This was followed by hierarchical and network databases, which utilized parent-child relationships but struggled with complex data connections. The introduction of relational databases marked a significant advancement, leading to their dominance today; over 74% of current database usage is relational. However, due to the surge in data from social media platforms, non-relational databases have gained popularity as well. Major companies often employ both types for optimal performance—Oracle leads in relational solutions while MongoDB excels among non-relational options.
Relational Database
00:06:24Relational databases organize data into tables that are interconnected. Each table is made up of columns, which have specific names and associated data types defining the rules for what can be stored in them. Rows represent individual records within these tables, encapsulating related information according to the defined structure.
Table Relations
00:06:57In an office database, information about employees, managers, and departments is stored in separate tables that are interconnected through specific columns. For instance, the employee table relates to the manager table via a manager ID column present in both. Similarly, the relationship between managers and departments is established through a department ID column. Although there isn't a direct link between employees and departments, data can still be retrieved from these tables based on conditions set within SQL queries. Relational databases allow for efficient data management by linking multiple tables using foreign key constraints.
Nonrelational Database
00:08:31Non-relational databases encompass various categories, including key-value stores, document databases, graph databases, wide-column stores, search engine databases, and time-series databases. Each type is designed to store data in unique ways tailored for specific use cases. Understanding these distinctions helps in selecting the right database solution based on the nature of the data being managed.
KeyValue Database
00:08:58Key-value databases, also known as key-value stores, are the simplest form of non-relational databases. Each piece of data is associated with a unique key that allows for easy storage and retrieval; users provide a key along with various types of data like images or JSON objects. These databases excel in managing specific kinds of information such as configuration settings or state details, often represented similarly to dictionaries in programming languages. Popular examples include Redis and Memcached.
Document Database
00:09:41Document databases, also known as document stores, utilize unique keys to identify stored data. Unlike key-value stores, they organize information in structured formats called documents—commonly using JSON or XML. Each document can have its own structure while still being understood by the database system. This flexibility allows for more complex querying and analysis of the data compared to traditional key-value storage solutions. Popular examples include MongoDB and CouchDB.
Graph Database
00:10:25Graph databases are a type of non-relational database that utilize nodes, edges, and properties to represent data and relationships. Unlike traditional relational databases that rely on tables and foreign keys, graph databases establish connections through edges linking individual nodes. This structure is particularly advantageous for scenarios where the relationships between data points are crucial, such as in fraud detection or analyzing complex transactions. Neo4j is an example of a widely used graph database.
White Column Database
00:11:23White column databases, or column family databases, organize data in rows and columns without traditional tables. Instead, they utilize structures called column families that contain uniquely identified rows with flexible schemas. Each row can have a varying number of columns and different types of data values. Notable examples include Cassandra and HBase.