Introduction to SQL and SELECT
SQL (Structured Query Language) is how you talk to a relational database, data organized into tables made of rows and columns. Almost every application with a database uses SQL under the hood.
Imagine a students table:
| id | name | xp |
|---|---|---|
| 1 | Ada | 120 |
| 2 | Grace | 95 |
| 3 | Alan | 60 |
Selecting data
SELECT name, xp
FROM students;
SELECT *
FROM students;
SELECTlists the columns you want back, or*for every column.FROMsays which table to read from.- Every statement ends with a semicolon
;.
NOTE
SQL keywords like SELECT and FROM aren't case-sensitive (select works too), but writing them in UPPERCASE is the near-universal convention, it makes queries easier to scan.