
Here's a preview from my zine, Become a SELECT Star!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

read the transcript!
A SQL database contains a bunch of tables
sales:
| client | item |
|——-|——–|
| x | x |
| x | x |
| x | x |
clients:
| id | name |
|——-|——–|
| x | x |
| x | x |
| x | x |
cats:
| owner | name |
|——-|——–|
| x | x |
| x | x |
| x | x |
Every SELECT query takes data from those tables and outputs table of results.
cats:
| owner | name |
|——-|————|
| 1 | daisy |
| 1 | dragonsnap |
| 3 | buttercup |
| 4 | rose |
query:
SELECT *
FROM cats
WHERE owner = 1
query output
owner | name |
---|---|
1 | daisy |
1 | dragonsnap |
A few basic facts to start out:
- SELECT queries have to be written in the order:
SELECT ... FROM ... WHERE ... GROUP BY ... HAVING ... ORDER BY ... LIMIT
- SQL isn’t case sensitive:
select * from table
is fine too.
This zine will use ALL CAPS for SQL keywords like FROM
.
smiling stick figure with curly hair: there are other kinds of queries like INSERT/ UPDATE / DELETE
but this zine is just about SELECT