Turning Learners Into Developers
Codekilla
CODEKILLA
back to course
Lesson 01 / 2980%· free preview
Introduction to SQL1/11

What is SQL?

Structured Query Language — the universal grammar of relational data.

// table = grid of rows × columnsidnameemailcountry1Ashaasha@ex.comIN2Raviravi@ex.comIN3Meimei@ex.comSGClick a step to highlight the table / row / column.
Visual explanation diagram · click steps to walk through it
Definition

SQL (Structured Query Language) is the ANSI/ISO standardised language for talking to relational databases. It dates back to IBM in the 1970s and is the lingua franca of every relational DB — MySQL, PostgreSQL, Oracle, SQL Server, SQLite all speak it.

How It Works

SQL is declarative — you describe WHAT you want (SELECT name FROM users WHERE age > 18), the database engine figures out HOW to get it. Plans, indexes, join order — all the database's job.

Example
sql
-- Your first SQL statement
SELECT 'Hello, SQL!' AS message;
Expected Output
(Run in MySQL Workbench, pgAdmin, or any SQL playground — actual values depend on the data in YOUR tables.)
Why It Matters

Every backend role on the planet expects SQL fluency. Learning it once pays dividends across every database vendor for your whole career.

Key Takeaways
  • Standardised by ANSI (1986) and ISO (1987); updated roughly every 5-7 years.
  • Declarative (what) vs imperative (how) — the engine plans execution.
  • Same SQL runs on Postgres, MySQL, Oracle, SQLite — modulo vendor extensions.
  • Three sub-languages: DDL (CREATE/ALTER/DROP), DML (INSERT/UPDATE/DELETE/SELECT), DCL (GRANT/REVOKE).
  • Read-mostly workloads = SELECT-heavy; write-heavy = INSERT/UPDATE-heavy.
Interview Questions

Practice Questions
  1. Run SELECT VERSION(); on any SQL database — note the dialect.
  2. Compare the same SELECT in MySQL and PostgreSQL — observe identical behaviour.
  3. Read the Wikipedia entry on SQL standards — note ANSI vs ISO timeline.
Pro Tips
  • When learning, default to a standards-compliant subset — ports easily across DBs.
  • Watch out for vendor extensions (AUTO_INCREMENT, RETURNING, etc.) that aren't portable.
  • Books: 'SQL Performance Explained' (Markus Winand) is the classic.
// Try It Yourself · SQL Playground
in-browser SQLite · no network

Run any SELECT, INSERT, JOIN or GROUP BY against the seeded users · products · orders tables — your changes are sandboxed and reset whenever you click Reset DB.

Click Run to see results here.
// see seed schema (3 tables · 8 users · 8 products · 12 orders)
users (id, name, email, country, age, created_at)
products (id, name, price, stock, category)
orders (id, user_id → users.id, product_id → products.id, qty, total, created_at)
// Challenges0 / 6 solved

Each challenge is auto-graded — write the SQL, click Submit answer, and we'll compare your result-set to the canonical one.

AI-powered recap

Quick recap quiz?

We'll generate 5 MCQs from this lesson and check your understanding instantly. Takes ~30 seconds.

Ready to move on?
// example library
Want more hands-on snippets in SQL?
Browse 1 runnable example · across 1 chapter · short, copy-paste-friendly · grouped by topic
Explore examples
// side-by-side reference
See this in other languages
Compare the same concept across C, C++, Java, and Python — one table, zero tab-switching.
Compare Languages
// feedback.matters()
Did this lesson help you?