SQL with Dutta โ€บ Module 1 โ€” SQL Fundamentals โ€บ Introduction to Databases
Module 1 ยท SQL Fundamentals

Introduction to Databases โ€” Types, Properties & CRUD

This session introduces what a database is, why it matters, the core properties every good database should have, and the major categories of databases (Relational, NoSQL, Column, Graph, Key-Value) โ€” including when each type is typically used.

Key Concepts


1. What are Databases?

Definition: A Database is a shared collection of logically related data (and a description of that data), designed to meet the information needs of an organization.

Note: the word shared is important โ€” a database is meant to be accessed by multiple users/applications at once, and logically related means the data isn't random โ€” it's organized so relationships between pieces of data make sense (e.g., a customer and their orders).

Why we use Databases (4 core purposes)

PurposeWhat it means
Data StorageStores large amounts of structured data, making it easily accessible, searchable, and retrievable.
Data AnalysisUsed to perform complex data analysis, generate reports, and provide insights into the data.
Record KeepingKeeps track of important records โ€” e.g., financial transactions, customer information, inventory levels.
Web ApplicationsDatabases power dynamic content and user management for most web apps.

CRUD Operations

Every database (regardless of type) supports four fundamental operations, remembered by the acronym CRUD:

C โ€” Create   (add new data)
R โ€” Retrieve (read/query existing data)
U โ€” Update   (modify existing data)
D โ€” Delete   (remove data)
๐Ÿ’ก Tip: Whenever you interact with any database (SQL, NoSQL, etc.), what you're doing under the hood is almost always one of these four operations.

2. Properties of an Ideal Database

An ideal database should have these 5 properties:

  1. Integrity โ€” data should be accurate and consistent (i.e., no contradictory or corrupted data).
  2. Availability โ€” the database should be accessible 24ร—7.
  3. Security โ€” protect data from unauthorized access.
  4. Independent of Application โ€” the database shouldn't be tightly coupled to one single application; it should be usable by multiple applications/services independently.
  5. Concurrency โ€” the database should handle multiple users/processes accessing/modifying data at the same time without conflicts or corruption.

Diagram: "Independent of Application" concept

The instructor's sketch showed one central database being accessed by multiple separate applications (Web, Mobile, iOS), illustrating that a well-designed database is not owned by a single app โ€” many apps/services can read/write to it independently.

flowchart TB DB((Central Database)) Web[Web] Mobile[Mobile] IOS[iOS] Web --> DB Mobile --> DB IOS --> DB

Things to Remember:

โ€” Integrity โ†’ Accuracy + Consistency
โ€” Availability โ†’ 24ร—7 uptime
โ€” A single DB should be reusable across multiple independent applications (not hard-coded to just one app)


3. Types of Databases

There are 5 major types of databases:

#TypeAlso Known AsBest Suited ForExamples
1Relational DatabasesSQL databasesStructured data organized into tables (rows & columns); everyday transactional appsMySQL, PostgreSQL, Microsoft Access
2NoSQL Databasesโ€”Large amounts of unstructured/semi-structured data โ€” documents, images, videosMongoDB
3Column Databasesโ€”Data warehousing & analytical applications (OLAP)Amazon Redshift, Google BigQuery
4Graph Databasesโ€”Graph-structured data โ€” social network connections, recommendation systemsNeo4j, Amazon Neptune
5Key-Value Databasesโ€”Caching & simple data storage needs (fast lookups)Redis, Amazon DynamoDB

3.1 Relational Databases (SQL)

Example sketched in class: two tables โ€” Sportsperson and Cars โ€” connected via a relationship (e.g., a foreign key linking a sportsperson to a car they own).

erDiagram SPORTSPERSON ||--o{ CARS : owns SPORTSPERSON { int sportsperson_id PK } CARS { int car_id PK int sportsperson_id FK }
Note: the exact column names weren't legible in the handwritten sketch (only "pk" and general relationship arrows were visible) โ€” the key takeaway is that relational databases link separate tables together through key relationships, rather than storing everything in one giant table.

3.2 NoSQL Databases

3.3 Column Databases

3.4 Graph Databases

3.5 Key-Value Databases


4. Relational (OLTP) vs Column (OLAP) Databases

This was a key comparison drawn out in class โ€” Relational databases and Column databases solve different problems, even though both are "structured":

flowchart LR subgraph Relational_DB [Relational DB] direction TB A1[OLTP] A2[Stores data by ROWS] A3[Used by: Website / App] end subgraph Column_DB [Column DB] direction TB B1[OLAP] B2[Stores data as Datawarehouse] B3[Used by: Analyst] end
AspectRelational DBColumn DB
TypeOLTP (Online Transaction Processing)OLAP (Online Analytical Processing)
Data organized byRowsColumns
Typical consumerWebsite / application (day-to-day operations)Analyst (reporting, analytics, business intelligence)
๐Ÿ’ก Tip (how to remember):
โ€” OLTP = Transactions โ†’ think "website placing an order" โ†’ row-based, relational.
โ€” OLAP = Analytics โ†’ think "analyst running reports on years of sales data" โ†’ column-based, data warehouse.

Things to Remember


Quick Revision (1โ€“2 min read)

A database is a shared, organized collection of data used for storage, analysis, record-keeping, and powering web apps. Every database supports CRUD operations. A good database should be accurate & consistent (Integrity), always available (24ร—7), secure, independent of any single application, and able to handle concurrent access.

There are 5 main database types: Relational (SQL โ€” tables of rows/columns, e.g. MySQL, PostgreSQL), NoSQL (unstructured data, e.g. MongoDB), Column (analytics/data warehousing, e.g. Redshift, BigQuery), Graph (relationships/networks, e.g. Neo4j), and Key-Value (fast caching, e.g. Redis, DynamoDB).

The most important practical distinction: Relational databases are OLTP (row-based, used by live applications for transactions) while Column databases are OLAP (column-based, used by analysts for reporting and data warehousing).