SQL: Master Databases from Scratch
Chapter 1 / 8· 16 min read· 0 cards

What is SQL and How Databases Work

Why SQL is essential, what a relational database is, and the structure of tables.

Why learn SQL?

Almost every application you use — your bank, an online store, a social network, a college portal — stores its information in a database. And the language used to talk to those databases is SQL (Structured Query Language). SQL is how you ask a database questions ("which customers spent the most last month?"), add new information, update it, and organise it. It's been the standard for decades and isn't going anywhere.

SQL is one of the most valuable and widely-required skills in all of tech. Backend developers use it to power their apps, data analysts use it to find insights, data scientists use it to pull data for their models, and even product managers and marketers use it to answer questions about their users. Unlike a full programming language, SQL is focused and learnable quickly — and that combination of high demand and approachability makes it one of the best skills you can pick up.


What is a relational database?

The most common kind of database is a relational database, and the idea is intuitive: data is organised into tables, much like spreadsheets. A table has columns (the kinds of information, like name or age) and rows (each individual record). Here's a simple students table:

+----+--------+-----+------------+
| id | name   | age | city       |
+----+--------+-----+------------+
| 1  | Mehul  | 19  | Ahmedabad  |
| 2  | Riya   | 20  | Mumbai     |
| 3  | Arjun  | 18  | Delhi      |
+----+--------+-----+------------+

Each column holds one type of information; each row is one student's complete record. The power of a relational database is that you can have many tables — students, courses, enrolments — and define relationships between them. That's what "relational" means, and it's what makes these databases so powerful for real-world data.


SQL vs the database system

A quick clarification that helps avoid confusion. SQL is the language. The actual software that stores the data and runs your SQL is called a database management system (DBMS). Popular ones include MySQL, PostgreSQL, SQL Server, and SQLite. They all speak SQL, with small dialect differences.

The wonderful thing is that the core SQL you'll learn in this course works across all of them. Learn it once, and you can work with almost any database. This course uses standard SQL (close to MySQL, one of the most common), and the playground lets you run real queries as you learn — no setup required.


The kinds of things SQL lets you do

SQL commands fall into a few natural groups, and we'll cover them all:

  • Querying data — asking questions and reading data (the SELECT command). This is what you'll do most, so we start here.
  • Modifying data — adding, changing, and removing records (INSERT, UPDATE, DELETE).
  • Defining structure — creating tables and defining their columns and rules (CREATE TABLE).

The vast majority of real SQL work is querying — getting answers out of existing data. So that's where we'll focus first, and it's where SQL feels almost magical: you describe what data you want, and the database figures out how to get it. Let's write our first query.


A taste of SQL

Here's what a SQL query looks like — readable almost like English. This one asks for the names of all students from Ahmedabad:

SELECT name
FROM students
WHERE city = 'Ahmedabad';

Read it aloud: "select the name, from the students table, where the city is Ahmedabad." That readability is one of SQL's great strengths — you describe the result you want in plain, structured terms. In the next chapter, we'll dive deep into SELECT, the command you'll use more than any other.

Reading mode · scroll to read at your own pace

Finished "What is SQL and How Databases Work"?

Mark this chapter complete so you can pick up exactly where you left off. Your progress saves locally — sign in to sync across devices.

Was this chapter clear?

Try it yourself — open the Code Playground15+ languages — Python, JavaScript, Java, C++, SQL & more — full IDE-style editor, instant run. Your code is auto-saved per language.