3.
Databases 🗄️
Page 1: What is a Database?
A database is an organized collection of structured information, or data, typically
stored electronically in a computer system. It's designed to make it easy to store,
manage, and retrieve information. The primary purpose of a database is to provide an
efficient and reliable way to access and manipulate data. A Database Management
System (DBMS) is the software that interacts with the user, applications, and the
database itself to capture and analyze the data.
The most common type of database is the Relational Database, which organizes data
into one or more tables of rows and columns, much like a spreadsheet. Each table has a
unique key that identifies each row, and relationships can be established between tables.
The language used to interact with relational databases is Structured Query Language
(SQL).
Key components of a relational database are:
Tables: The fundamental building blocks, consisting of columns and rows.
Columns (Fields): Represent specific attributes of the data. For example, in a
"Students" table, columns might be StudentID, FirstName, LastName.
Rows (Records): Contain all the information about a single entry. Each row in
the "Students" table would represent a single student.
Keys: These are used to uniquely identify records and create relationships
between tables. A primary key uniquely identifies a row in a table, while a
foreign key is a column that refers to the primary key of another table, linking
the two.
Page 2: Types and Uses
While relational databases are dominant, there are other types of databases designed for
specific needs. These are often referred to as NoSQL (Not only SQL) databases. Some
key types of databases include:
Relational Databases (SQL): Best for structured data where relationships
between data points are important. Examples: MySQL, PostgreSQL, and SQL
Server.
NoSQL Databases: Better for unstructured or semi-structured data, high-
volume data, and flexible schemas. They come in various models:
o Key-Value: Stores data as a collection of key-value pairs.
o Document: Stores data in document-like structures (e.g., JSON).
o Columnar: Stores data in columns instead of rows, which is great for
analytical queries.
o Graph: Stores data as nodes and edges, perfect for representing
relationships.
In-Memory Databases: Stores data primarily in the computer's RAM,
providing extremely fast data access.
Data Warehouses: A large, centralized repository of data from many sources,
used for reporting and data analysis.
Databases are essential for almost every modern application. They are used in banking
for transaction records, in e-commerce for managing products and customer
information, in social media for storing user profiles and posts, and in scientific research
for managing vast amounts of experimental data. They are the backbone of the digital
world.