beginner
Introduction to SQL
What SQL is, why it matters, and how you'll learn it in this course.
4 min read
Explanation
SQL (Structured Query Language) is the language used to talk to relational databases — systems that store data in tables made of rows and columns. Whenever an app shows you a list of orders, a dashboard of sales, or a search result, there's a good chance a SQL query produced that data behind the scenes.
Why learn SQL?
SQL is one of the most durable skills in software: it's used by backend engineers, data analysts, data scientists, and product managers alike.
A relational database organizes data into tables. For example, an
employees table might look like this:
| id | first_name | last_name | department_id | salary |
|---|---|---|---|---|
| 1 | Alice | Johnson | 1 | 128000 |
| 2 | Brian | Smith | 1 | 98000 |
Each row is one record (one employee), and each column is one attribute (first name, salary, and so on).
Syntax
SQL is made up of statements. The most common statement — and the one
you'll use constantly — is SELECT, which reads data out of a table:
SELECT column_name FROM table_name;Interactive Example
Every lesson in this course includes a live editor connected to a real in-browser database. Try running the query below — you can edit it freely.
Loading database engine...
Common Mistakes
- Forgetting the semicolon. Most SQL tools don't strictly require it for a single statement, but it's good practice and required when running multiple statements together.
- Assuming SQL is case-sensitive for keywords.
SELECT,select, andSelectall work identically — keywords are case-insensitive. Column and table names, however, can be case-sensitive depending on the database.
Best Practices
- Write SQL keywords in
UPPERCASEand identifiers inlowercase— it makes queries far easier to scan. - Always know what table you're querying before you start filtering or joining — a clear mental model of the schema prevents most beginner bugs.
Practice Question
Using the playground above, write a query that returns the first_name and
department_id of every employee, without any filtering or sorting.
Summary
SQL lets you retrieve and manipulate data stored in relational tables. The
rest of this course builds up from SELECT to advanced techniques like
window functions and CTEs — always with a real database to practice against.