First questions to the data · Lesson 1 of 20
What are SQL and databases?
Tables, rows and columns, and your first query.
Every app you use holds data: users, orders, messages. A database stores that data in an organized way, so you can search and change it quickly even with millions of rows.
The most common kind is the relational database: data is split into tables. Each table has fixed columns, and each row is one thing: one student, one course.
| id | name | city | xp |
|---|---|---|---|
1 | Laila | Cairo | 320 |
2 | Karim | Alexandria | 150 |
3 | Omar | Cairo | 90 |
… | … | … | … |
The students table: each row is a student, each column a fact about them.
SQL (said "sequel" or "S-Q-L") is the language you use to talk to a database. You say what you want and the database decides how to get it. That's a declarative style, unlike JavaScript and Python where you write the steps yourself.
The first and most important command is SELECT: "give me". The star * means every column. Press Run:
SELECT * FROM students;
Quick question
In the students table, what does one row represent?
Exercise
There's another table called courses. Write a query that shows all of its columns and rows.
id | title | track | price | hours 1 | HTML & CSS | web | 0 | 12 2 | JavaScript | web | 450 | 30 3 | Python | data | 400 | 28 4 | SQL | data | 300 | 16 5 | React | web | 600 | 24 6 | C++ | systems | 500 | 36
-- Write your query here
Learn more from
Played 0 of 2 games
Sign in to save your progress and earn XP.