Select specific columns
SELECT * grabs every column of every row. It works, and it's the fastest way
to peek at a table you don't know yet - but real, day-to-day queries almost
always name the columns they need instead. Naming columns is faster to send
back, clearer to read six months later, and it doesn't quietly change shape
when someone adds a column to the table.
You have a users table with columns id, name, country, and age. Every
query on this page runs against a real, live copy of it - nothing you do here
can break anything.
Your task: return only the name column, for every user.
You'll practice:
- Naming columns in a
SELECT instead of using *
- Reading a small table's schema before you query it
Related reading: Asking for Data: SELECT ... FROM →