Introduction
Boolean
30. Boolean
Date and time
Summary

Instruction

Wow, perfect! We can now move on to another data type.

BOOLEAN is a data type used to store logical values: true or false. This data type usually answers a yes/no question like "Does the user keep pets?". BOOLEAN types are convenient because they require really little space.

For your information, some databases don't have a separate BOOLEAN type and they simulate it using other types.

Exercise

Some users complain that there are fake accounts on the dating website. Peters wants to introduce a new feature - user verification. For now, let's create a simple table called verification with two columns: user_id (integer) and is_verified (boolean).

Stuck? Here's a hint!

Type

CREATE TABLE verification (
    user_id int,
    is_verified boolean
);

Console

Code editor

Result

TableConsole