← All NukteSELECT * FROM TheShiraverse
Module 1 › What is SQL? + SQL Terminology

What is SQL? And the terminology you need first

Module 1, Session 1. No coding yet — every story and practice problem from tonight's class, in the order it's taught. Full agenda just below.

Jo class mein bola, yahan nukte mein likha hai.
What I said in class, written here as key points.

Every App You Love Is a Pretty Shell on Top of a Massive Database

Netflix
Entertainment / OTT
DQL READ
User taps: "Top 10 Movies in India"
SELECT title, rank
FROM shows WHERE country = 'IN'
ORDER BY rank ASC LIMIT 10;
Global Scale: ~30 Crore Subscribers
Swiggy
Food Delivery & Quick-Com
JOIN QUERY
User searches: "Hyderabadi Biryani"
SELECT r.name, m.price
FROM menu m JOIN rest r ON m.r_id=r.id
WHERE m.dish ILIKE '%biryani%';
Peak Order Rate: ~15,000 Orders / Min
PhonePe
Fintech / UPI Payments
ACID TRANSACTION
User sends: "₹500 via UPI"
UPDATE accounts SET bal = bal - 500 WHERE id = 101;
INSERT INTO ledger (txn_id, amt)
VALUES (gen_random_uuid(), 500);
Daily Throughput: ₹10,000+ Cr Volume
Instagram
Social Media Network
DML INSERT
User double-taps: "Like Reel"
INSERT INTO reel_likes (reel_id, user_id)
VALUES (892019, 1042)
ON CONFLICT DO NOTHING;
Active Users: ~300 Crore Monthly
📊 01 • Data vs Information
Isolated numbers mean nothing. Schema structure and relational context turn raw bytes into executive decisions.
🏛️ 02 • The Bank Vault Model
Why no enterprise runs on spreadsheets. How DBMS engines protect data integrity under concurrent write loads.
⚖️ 03 • SQL vs NoSQL Reality
WhatsApp Group anarchy vs Google Sheet order. Mathematical relational sets vs flexible document blobs.
👑 04 • 50 Years of Dominance
Why SQL survived flat files, XML, and Big Data fads to remain the indispensable #1 language in the age of AI.

From First Concepts to Live Arena

Phase 01 🏛️ Foundations
01 Data vs Information ⚡ Concept

Why raw numbers are meaningless. Context + structure = intelligence.

02 Database vs DBMS 🏛️ Analogy

The bank vault model. Why no enterprise runs on spreadsheets.

Phase 02 ⚖️ SQL vs The World
03 SQL vs NoSQL ⚖️ Showdown

WhatsApp Group chaos vs Google Sheet order. When to use which.

04 Why PostgreSQL? 👑 80/20 Rule

50 years of dominance. Why SQL is still #1 in the age of AI.

Phase 03 ⚔️ Practice
05 52-Year Evolution 📅 Timeline

From Codd's 1970 paper to PostgreSQL powering Swiggy today.

06 Live Practice Arena ⚔️ Arena

Query the world of databases. 4 difficulty levels, progressive.

🎯
Today's Goal Understand why SQL exists and write your first real mental query.
⚔️
Live Arena Practice 4 progressive challenges embedded directly in class.
🛡️
No Setup Today 100% mental models. Zero terminal errors. Laptop optional.

Only what was actually covered in this session.

Before You Even Reached This Class Today

Tap a number, or press →
Your morning, decoded
Every one of these already happened today, before you sat down for this class. Click through and see the database query behind each one.

By the end of this course, you will be the one writing these. That language is called SQL. And it starts today.

Click through each moment to see the query behind it.

Why This Matters For Your Career

Every company — from a 5-person startup to Reliance — stores its business data in databases. The people who can QUERY that data, EXTRACT insights, and ANSWER business questions are called Data Analysts. They are the translators between raw data and business decisions.

52 yrs
SQL has been the language of data since 1974
~24L
rows of real retail data you'll query
#1
not Python, not Excel, not Power BI

Over this course, you go from "what is a database?" to writing queries — the same kind running at Flipkart, Amazon, and Myntra right now.

RetailMart, the database this course uses, is real and full-sized: 16 schemas, 55 tables, roughly 23,91,602 rows.

The Data → Information Pipeline

Raw Data + Context + Structure = Intelligence
📄 Raw Data (Isolated Facts)
The number '42' sitting alone in an unformatted text file. Is it a temperature in Delhi? An age? A shoe size? A pin code? Nobody knows. Isolated bytes are meaningless without architectural context.
→ Unstructured • Zero schema • High ambiguity
↓ Relational Transformation ↓
💡 Information (Actionable Intelligence)
customers.age = 42. NOW the number has meaning. The database pre-declares column names, constraints, and relationships so data automatically becomes queryable business intelligence.
→ Typed • Indexed • Queryable in <1ms
⚙️ Interactive Context Lab CLICK ANY VALUE TO REVEAL CONTEXT
RAW DATA (Meaningless Alone) INFORMATION (Data + Context + Schema)
⚙️ ?
⚙️ ?
⚙️ ?
⚙️ ?
⚙️ ?
⚙️ ?

Same bytes. Add COLUMN NAMES and RELATIONAL STRUCTURE → instant intelligence.

Database vs DBMS — Think of a Bank

Tap a number, or press →
Database vs DBMS, as a bank
You never walk into the vault yourself. Click through and see who does what.
RDBMS (Relational DBMS): a DBMS that stores data in TABLES (rows and columns) and allows RELATIONSHIPS between tables using Keys. 'Relational' does not mean 'related' — it comes from 'relation', a mathematical term for a table. PostgreSQL, MySQL, Oracle, SQL Server — all RDBMS.

Click You, DBMS and Database in turn to see how the bank analogy maps to each term.

SQL vs NoSQL — Same Class, Two Ways to Collect Data

Your college class has a WhatsApp group with 80 students. The class representative posts: "Everyone send your name, roll number, phone number, and blood group."

Tap a number, or press →
Same 80 students. Same 4 questions.
Click each one and see how the same request plays out two different ways.

The key insight: both stored the same information. But when the principal asks 'How many students are B+ blood group?' — the spreadsheet answers in 2 seconds. The WhatsApp group? You are still scrolling through memes.

Click through both to compare unstructured (NoSQL) vs structured (SQL) collection of the exact same data.

Relational (SQL) vs Non-Relational (NoSQL)

Architectural Dimension 🐘 Relational (SQL) ⚡ Non-Relational (NoSQL)
Data Structure Strict Tables: Predefined 2D matrix of typed columns & rows Flexible Shapes: JSON documents, key-value blobs, wide columns
Schema Governance Predefined & Enforced: Engine strictly rejects non-conforming data Schema-less / Dynamic: Every record can contain different fields
Relationships Foreign Keys: Strict mathematical relational glue linking tables De-normalized: Embedded nested sub-documents or client-side joins
Data Integrity ACID Guaranteed: Infallible transactions (zero lost rupees/orders) BASE / Eventual: Prioritizes availability over immediate consistency
Query Standard SQL: Universal ANSI standard query language since 1986 Proprietary APIs: Custom dialect per database engine
Scaling Paradigm Vertical Scale: High single-node CPU/RAM, read-replicas Horizontal Scale: Distributed automatic sharding across clusters
Ideal Workloads Banking, e-commerce orders, ledger, analytics, source-of-truth Real-time chat, session caching, IoT telemetry, unstructured logs
🐘 Proven Relational Engines SQL Standard
PostgreSQL MySQL Oracle Database Microsoft SQL Server SQLite
⚡ Specialized NoSQL Categories NoSQL Flavors
MongoDB (Document) Redis (In-Memory Cache) Cassandra (Wide-Column) DynamoDB (Key-Value) Neo4j (Graph) ClickHouse (Columnar)

The 80/20 Rule of Databases

Enterprise Data Volume Distribution Rule of Thumb • Mission-Critical Systems
~80% Relational (SQL / RDBMS) Financials • Orders • Core Ledger
~20% NoSQL
The Enterprise Reality: Even companies that run MongoDB, Cassandra or Redis keep their money and orders in a relational SQL database. Why? ACID guarantees for money cannot be compromised.
Tap any node above
Polyglot Persistence in Production
Top companies never pick just one database — they orchestrate a specialized stack where each engine does what it was born to do. Click each engine to inspect its role.

The single system that must NEVER lose a record is almost always PostgreSQL.

The Evolution of Databases — Half a Century of Dominance

CHRONOLOGICAL TIMELINE: 1960s → 2026+
5 Generations of Tech • SQL Survives & Triumphs
1960s 📄
Pre-Database Era
Flat Files & CSVs
Data dumped into text files. Zero data types, zero transactional safety, concurrent writes corrupted everything.
Manual string parsing No indexing Constant data loss
1970 🧠
Mathematical Genesis
Codd's Relational Law
Edgar Codd (IBM) invents the Relational Model. Tables, rows, and mathematical set relations are born.
1974: IBM System R SQL prototype born Declarative WHAT vs HOW
1979–96 🏢
Commercial & Open Source
Oracle & PostgreSQL
Oracle commercializes RDBMS (1979). ANSI standardizes SQL (1986). Berkeley’s POSTGRES becomes open-source PostgreSQL (1996).
Enterprise gold standard Universal SQL dialect Free open-source engine
2009–12 ⚡
The NoSQL Bubble
NoSQL & NewSQL
MongoDB launches for dynamic JSON schemas. But companies discover they cannot live without ACID. Google builds Spanner.
Eventual consistency limits Return to ACID Distributed SQL rises
2024–26 🏆
The Modern Champion
PostgreSQL 17 & 18
PostgreSQL absorbs JSONB, vector search (pgvector) and scale-out extensions like Citus. The undefeated master database of modern tech.
Native JSONB + ACID AI Vector embeddings You are mastering this now
💡
The 52-Year Rule: SQL was created in 1974. It has outlived 5 generations of programming languages, survived the NoSQL revolution, and remains the single most resilient skill in computer science.
65%
Practice Milestone

Query Mode: Unlocked — The World of Databases

You learned the weapon. Now use it. Work through the 4 challenge portals below: Easy, Medium, Hard, and Crazy.

🧠Practice Time

SQL Intro Self-Check — 12 Essential Concepts

🧠 Close your notes. Test your mastery before moving forward: Target: 10+ Correct = Production Ready
Q01 FOUNDATIONS
Data vs Information difference with a real example?
Data = Raw symbols (e.g. 47).
Information = Data + Context (e.g. "Store #47 generated ₹47,000 sales").
Q02 RDBMS
What is DBMS vs RDBMS? Is Postgres DBMS or RDBMS?
RDBMS stores data in connected tables with PK/FK constraints. PostgreSQL is a full enterprise RDBMS.
Q03 SQL VS NOSQL
When does SQL win vs when does NoSQL win?
SQL: ACID money transactions & relational joins (80%).
NoSQL: High-throughput IoT logs & JSON documents (20%).
Q04 5 CATEGORIES
Name the 5 SQL families and give 1 command from each.
DDL (CREATE), DML (INSERT), DQL (SELECT), DCL (GRANT), TCL (COMMIT).
Q05 INTEGRITY
What is a Primary Key? Why can 2 rows not share it?
Unique row identifier (never NULL, never duplicate). Prevents duplicate customer/order identities.
Q06 RELATIONSHIPS
What is a Foreign Key? What major problem does it solve?
Points to another table's PK. Prevents orphan records (e.g. orders for non-existent customers).
Q07 HIERARCHY
What is the universal 6-level Database Hierarchy?
Server → Database → Schema → Table → Row → Cell (atomic value).
Q08 PARADIGMS
Is SQL declarative or imperative? Explain in 1 sentence.
Declarative: you tell the database WHAT data you want, not HOW to retrieve it.
Q09 PIPELINE
4 stages of Query Pipeline? Which stage decides HOW?
Parser → Analyzer → Planner (decides HOW) → Executor.
Q10 CAREERS
Name 3 careers that use SQL daily and what they do.
Data Analyst: Reports (80%).
Data Engineer: ETL pipelines (70%).
DBA: Performance tuning (90%).
Q11 EXCEL VS DB
Excel handles 10 lakh rows. Why do we still need Postgres?
Concurrent multi-user writes, ACID rollback guarantees, zero crashes on crores of rows.
Q12 REAL WORLD
Name 3 Indian companies powered by PostgreSQL.
Razorpay: Ledgers.
Zerodha: Trade records.
IRCTC: Reservation bookings.

Key Takeaways — The 7 Golden Laws

The 7 immutable principles and architectural rules you must remember from this session.

01 Foundation Law
Data → Context → Protected DBMS
Raw data has zero meaning until given context. A relational DBMS reliably protects, indexes, and queries it.
Raw Data 47
→
+ Context Mumbai Store
→
Protected DB PG Postgres
02 Production Law
The 80/20 Rule: SQL vs NoSQL
Production stacks run both: SQL owns core business transactions, NoSQL powers fast caches and logs.
SQL · 80% Core ✓ Strict ACID
✓ Money & Orders
NoSQL · 20% Fast ✓ JSON / Blobs
✓ Caches & Logs
03 Relational Glue
Table Anatomy & Key Integrity
Primary Key guarantees unique identity. Foreign Key links tables and makes orphan orders physically impossible.
PRIMARY KEY
customers.id
← FK →
FOREIGN KEY
orders.cust_id
04 Scale Architecture
The 6-Level Hierarchy
RetailMart production cluster: 1 database, 16 business schemas, 55 tables, ~24 lakh transactional records.
Server › Database › Schema (16) › Table (55) › Row › Cell
05 Command Matrix
The 5 SQL Families
Every command belongs to one family. Data Analysts spend over 90% of their working day inside DQL.
DDL · CREATE DML · INSERT DQL · SELECT (90%) DCL · GRANT TCL · COMMIT
06 Engine Pipeline
Declarative Power: WHAT vs HOW
You declare WHAT you need. The engine's 4-stage pipeline calculates the optimal execution plan.
1. Parse 2. Analyze 3. Plan (HOW) 4. Execute
07 The North Star Principle
The Modern Data Stack & Career Progression
Excel hits limits at 10 lakh rows. SQL extracts and aggregates native tables. Python models and visualizes. Master PostgreSQL once, and switching engines takes days.
Excel
Excel Ad-hoc Sheets
→
PostgreSQL
PostgreSQL (The Anchor) Native Source of Truth
→
Python
Python ML & Advanced Stats
→
Power BI
Power BI Executive BI Dashboards

SQL Architecture & Engine — Quick Reference Studio

Foundations Reference
POSTGRESQL PRODUCTION READY
01 • TAXONOMY The 5 SQL Categories
-- DDL: Structure (Schemas/Tables)
CREATE, ALTER, DROP, TRUNCATE

-- DML: Rows (Data Manipulation)
INSERT, UPDATE, DELETE

-- DQL: Query (90% of Analyst Time)
SELECT col1, col2 FROM table;

-- DCL: Security & Permissions
GRANT, REVOKE

-- TCL: Transaction Integrity (ACID)
COMMIT, ROLLBACK, SAVEPOINT
02 • HIERARCHY Database Hierarchy
-- Universal 6-Level Hierarchy:
Server Cluster   (Port 5432)
  └── Database   (RetailMart)
       └── Schema (Folder Namespace)
            └── Table (customers, orders)
                 ├── Column (Type + Rule)
                 └── Row (Atomic Entity)
                      └── Cell (Scalar)

-- Production Scope:
RetailMart: 16 schemas, 55 tables, ~24L rows.
03 • INTEGRITY Relational Integrity Triad
-- Primary Key (PK):
-- Never NULL, never duplicate. Unique row ID.
id SERIAL PRIMARY KEY

-- Foreign Key (FK):
-- Points to parent PK. Prevents orphan records.
customer_id INT REFERENCES customers(id)

-- ACID Guarantees:
Atomicity  — All or nothing
Consistency — Rules never broken
Isolation   — Concurrency safety
Durability  — Survives server crashes
04 • PIPELINE 4-Stage Engine Pipeline
-- On 'Execute', PostgreSQL engine runs:

Stage 1: Parser
-- Checks grammar/syntax (catches typos like FORM)

Stage 2: Analyzer
-- Catalog lookup: do tables/cols exist? Types.

Stage 3: Planner (Cost-Based Optimizer)
-- The "Brain": evaluates 1000+ paths, picks best.

Stage 4: Executor
-- The "Hands": touches RAM buffer/disk, returns rows.
05 • PARADIGM Declarative vs Imperative
-- Imperative (Python / Java):
-- You micromanage HOW step-by-step:
results = []
for row in addresses:
    if row['city'] == 'Mumbai':
        results.append(row)

-- Declarative (SQL):
-- You declare WHAT data you want. Engine optimizes:
SELECT *
FROM customers.addresses
WHERE city = 'Mumbai';
06 • RULES & SCALE Production Rules & Limits
-- Universal Production Rules:
• Semicolon (;) terminates every SQL statement.
• Keywords are case-insensitive (SELECT = select).
• Excel Hard Limit: 10,48,576 rows (crashes >10L).
• PostgreSQL: Crores of rows with index in ms.

-- SQL vs NoSQL (80 / 20):
• SQL: Strict schema, ACID, money & orders (80%).
• NoSQL: Flexible JSON, Redis caching, logs (20%).
• Polyglot Persistence: Production uses BOTH.

SQL Intro — Take-Home Challenge

TACTICAL MISSION CONTROL • INTRO MISSION
Complete These 5 Missions Before Session 2 (How SQL is Organised)
⏱️ DUE: 2 HOURS BEFORE CLASS ⚡ 100 XP REWARD
⭐ CORE ARCHITECTURAL MISSION • TASK 03 SYSTEM DESIGN
Reverse-Engineer Daily Apps (Swiggy / PhonePe / Blinkit)
Stop looking at apps as a user — see the relational database powering them behind the glass. Pick 1 consumer app you use every day:
🍔 Swiggy / Zomato 💳 PhonePe / Paytm ⚡ Blinkit / Zepto 🚗 Uber / Ola 🎵 Spotify
01
Draft 6 Interlinked Tables: e.g., users, restaurants, menu_items, orders, order_items, payments.
02
Specify 5+ Columns Per Table: Choose exact data types (BIGINT, VARCHAR, NUMERIC, TIMESTAMPTZ, BOOLEAN).
03
Wire the Relationships: Mark the Primary Key (PK) on each table and Foreign Keys (FK) linking child records to parents.
TASK 01 TOOLCHAIN
Download Core Toolchain
Download PostgreSQL 18 installer, pgAdmin 4, VS Code, and Git. Save to downloads; do not install yet.
TASK 02 REFLECTION
3 Surprising Insights
Re-read today's notes. Write down 3 facts that permanently changed your mental model of databases vs spreadsheets.
TASK 04 INDUSTRY
The 52-Year Inquiry
Research 1 technical or business reason why SQL outlived Pascal, Perl, and ActionScript to remain the #1 data skill.
TASK 05 BENCHMARK
12 Self-Check Benchmark
Retake the 12 self-check recall questions from memory. Target score is ≥ 10/12. Re-read weak sections if needed.
💬 Where to submit: Post your Task 03 table schemas in Discord #assignments or share in the WhatsApp Community! 🟢 PEER CODE REVIEW QUEUE ACTIVE

Master Curriculum Journey Roadmap

TheShiraverse Curriculum Flow
🟢 ACTIVE WAYPOINT: MODULE 1 • TOPIC 01 (What is SQL?)
Track: 60 Topics • 6 Modules • Free & Live
01
TOPIC 01 Today • Live
What is SQL?
Data vs Information Database vs DBMS SQL vs NoSQL 52 Years of SQL
📍 YOU ARE HERE ACTIVE
02
TOPIC 02 Next Class
How SQL is Organised
Tables, Rows, Columns Primary & Foreign Keys Database Hierarchy 5 SQL Families
⚡ UP NEXT Up Next
03
TOPIC 03 Session 3
Writing First Queries
SELECT as a Calculator CREATE • ALTER • DROP INSERT • UPDATE • DELETE The Safe WHERE Rule
🔒 NOT STARTED Later
04
TOPIC 04 Session 4
Data Types
Ending All-TEXT NUMERIC vs FLOAT INT • DATE • TIMESTAMPTZ ALTER ... TYPE ... USING
🔒 NOT STARTED Later
05
TOPIC 05 Session 5
Constraints & Keys
NOT NULL • DEFAULT CHECK • UNIQUE PRIMARY KEY FOREIGN KEY
🔒 NOT STARTED Later
✦ THE FOCUSED ASCENT: START FROM ZERO CONCEPTS TODAY ➔ MASTER MULTI-TABLE RELATIONAL QUERIES ➔ CROSS THE FINISH LINE WITH FAANG INTERVIEWS & A 24-LAKH ROW PRODUCTION CAPSTONE ✦

Next Session: From Pure Concepts to HANDS-ON PRODUCTION

NEXT MISSION • ENGINE & ARCHITECTURE
Cracking Open the Database Engine
What is a Database? + How SQL is Organised — From Pure Definitions to Port 5432 & The 5 SQL Families.
• LIVE STREAM • THE SHIRAVERSE
⚙️
1. The Engine Architecture
Why spreadsheets crash when 2 users edit simultaneously. How PostgreSQL coordinates client apps, background daemons on Port 5432, buffer cache, and zero-loss WAL logging.
CLIENT GUI ↔ DAEMON (5432) ↔ DISK
⚡
2. The 5 SQL Families
SQL is not one monolithic language — it is 5 families of commands, each with its own job:
DDL: Build CREATE, ALTER
DML: Change INSERT, UPDATE, DELETE
DCL: Security GRANT, REVOKE
TCL: Safety COMMIT, ROLLBACK
DQL: Read SELECT (what analysts use most)
💻
3. Hands-On Schema Build
You'll write and execute your first production DDL statements to blueprint the RetailMart database:
CREATE SCHEMA retail; CREATE TABLE retail.customers ( customer_id BIGSERIAL PRIMARY KEY, full_name VARCHAR(100) NOT NULL, joined_at TIMESTAMPTZ DEFAULT NOW() );
⚠️ PREREQUISITES FOR NEXT SESSION: Have PostgreSQL & pgAdmin 4 installer files downloaded. Do NOT install yet — we configure ports and master passwords together live!
Next: How SQL is Organised →
→ / Space next   ← back   F fullscreen   H hide bars   N notes
1 / 18