DevLearningTools

LEARN · SQL

SQL Introduction

SQL is the language you use to ask a database for data, or to change it. Learn how a relational database organizes data into tables, and why SQL and MySQL aren't the same thing.

Almost every app you use, from a banking app to a to-do list, stores its data somewhere and needs a way to ask for it back: "show me this user's orders," "find every product under $20." SQL (Structured Query Language) is the language used to ask those questions of a relational database, and to add, change, or remove data in it.

Learning Objectives

  • Explain what a relational database stores data in, and why that shape makes SQL possible.
  • Describe where SQL sits between an application and its data.
  • Tell SQL (the language) apart from MySQL, PostgreSQL, and other database systems that run it.

Your App

"Get this user's orders"

SQL Query

SELECT * FROM orders...

Database Engine

Finds the matching rows

Result

Rows sent back to your app

Data, Organized Into Tables

A relational database stores data in tables, which look a lot like spreadsheets. Each table holds one kind of thing, a users table, a products table, an orders table, and each row in that table is one record of that thing. Each column is one piece of information every row has.

Spreadsheet termDatabase termExample
SheetTableusers
RowRow (or "record")one specific user
Column headerColumn (or "field")email, created_at
One cellA value"ada@example.com"

SQL Is a Language, Not a Product

SQL itself is a standard (maintained by ISO/ANSI), not a piece of software you install. A very common mix-up for new developers: hearing "I'm learning SQL" and "I installed MySQL" and assuming they're the same statement. They're not, MySQL, PostgreSQL, SQLite, and SQL Server are all separate database systems, built by different companies and projects, that all understand SQL as their query language. They agree on the core of SQL, but each adds its own extra features and small syntax differences, called out throughout this course wherever they genuinely matter.

SQL databaseKnown for
MySQLThe most widely used, especially in web hosting and WordPress-style stacks
PostgreSQLStrong standards compliance, advanced features, popular for new production apps
SQLiteNo server, a database is just one file, used inside apps and for learning
SQL ServerCommon in enterprises already using Microsoft infrastructure
NOTE

This course's examples run on standard SQL that works the same across all four, and calls out the specific syntax for each wherever a real difference exists. SQLite is the easiest to follow along with yourself, since it needs no server to install, just a free tool like DB Browser for SQLite.

Try It Yourself

A products table has columns id, name, price, and category. Without writing any SQL yet, just in plain English: what question would "find every product under $20" become once it's expressed as a request to a relational database?

Answer
-- In plain English: "Give me the name and price of every row
-- in the products table where price is less than 20."
-- As SQL (covered in full over the next few lessons):
SELECT name, price
FROM products
WHERE price < 20;

Frequently Asked Questions

Is SQL a programming language?

Not in the same sense as Python or JavaScript. SQL is a declarative language: you describe the result you want ("rows where age > 18"), not the step-by-step logic to get it. The database engine figures out how to actually fetch it.

What's the difference between SQL and MySQL?

SQL is the language. MySQL is one specific database system that uses SQL. It's the same relationship as HTML (the language) and a web browser like Chrome (software that reads it).

Is SQL case-sensitive?

SQL keywords (SELECT, WHERE, FROM) aren't case-sensitive, SELECT and select work the same. By convention this course writes keywords in uppercase to make queries easier to read, covered in full in the next lesson.

Common Beginner Mistakes

Saying "I'm learning MySQL" when you mean SQL in general

This quietly narrows every tutorial, job listing, and search you'll do. Say "SQL" for the language and skill, and name the specific system only when a feature or quirk is actually specific to it.

Assuming a feature that works on one database works everywhere

Core SQL (SELECT, WHERE, JOIN, basic aggregates) is shared, but plenty of real features aren't, covered throughout this course whenever a genuine difference exists.

Best Practices

  • Say "SQL" when talking about the language or skill, and name the specific database system only when a difference actually matters.
  • Write queries in standard SQL first, and reach for a database-specific extension only once you actually need it.
  • Start learning on SQLite, it needs no server, just a free tool, and the SQL you learn transfers directly to MySQL, PostgreSQL, and SQL Server later.

Interview Questions

What actually makes a database "relational"?

Data is organized into tables with a fixed set of typed columns, where every row shares the same structure, and where tables can be explicitly connected to each other through foreign keys rather than nesting or duplicating data inside one record.

Is SQL a standard, and who maintains it?

Yes, SQL is standardized by ISO and ANSI. Database vendors implement that core standard and then add their own extensions on top, which is why two databases can both be "correct SQL" and still differ in places.

Summary

This lesson covered how a relational database organizes data into tables of rows and columns, where SQL sits between your application and the database engine, and why SQL (the language) is a separate thing from MySQL, PostgreSQL, and the other systems that implement it.

What's Next?

The next lesson covers SQL syntax, the actual rules for writing a statement: keywords, statement structure, and semicolons.

</>

Ready to Practice SQL?

Write and run real SQL queries online, right in your browser, no install or signup required. Pick a playground based on which database you want to practice on.

SQLite / PostgreSQL

Fast, no server, no ads.

Open DB Fiddle ↗

MySQL / SQL Server

Switch databases with one dropdown.

Open SQL Fiddle ↗

Both open a third-party SQL playground in a new tab. External site terms and privacy policy apply.