We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Select Single Column

Databases are made up of tables which are made up of columns (AKA "fields"). It's just like an Excel spreadsheet.

Our CashPal database has a users table with these columns:

  • id (integer)
  • name (string)
  • age (integer)
  • balance (float)
  • is_admin (boolean: true/false)

There can be many records (rows) in this table, each representing a single user. For example, here are three user rows:

id name age balance is_admin
1 John Smith 28 450 1
2 Darren Walker 27 200 1
3 Jane Morris 33 496.24 0

In the last lesson, we used the * wildcard to get all the columns. To select only a single column, we simply swap out the * for the name of the column.

Returns all columns from the users table:

SELECT * FROM users;

Returns only the name column from the users table:

SELECT name FROM users;

Assignment

Update the query to only select the age column from the users table.