skip to today's puzzle

Boolean columns hold TRUE or FALSE

Some columns hold a plain yes or no — is_available, is_decaf. SQL calls this a boolean column, which means its value is TRUE or FALSE (or NULL if unknown). You compare it to TRUE or FALSE directly, with no quotes, because it isn't text. SQL Server has no TRUE keyword; it stores yes/no as a BIT column holding 1 or 0.

A tiny example

In plain English: Show me the names of the menu items that are available.

SELECT name, is_available
FROM menu_items
WHERE is_available = TRUE;

Query result

nameis_available
Flat whiteTRUE
Tea cakeTRUE

Flat white and tea cake are the only menu items whose is_available value is TRUE.

Related SQL lessons

Ready for a break?

A fresh, bite-sized SQL puzzle waits every morning. Tap tiles, see real results. No terminal, no setup, no timers.

Try today's free SQL puzzle