> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# BOOL

The `BOOL` [data type](/docs/stable/data-types.md) stores a Boolean value of `false` or `true`.

## Aliases

In CockroachDB, `BOOLEAN` is an alias for `BOOL`.

## Syntax

There are two predefined [named constants](/docs/stable/sql-constants.md#named-constants) for `BOOL`: `TRUE` and `FALSE` (the names are case-insensitive).

Alternately, a boolean value can be obtained by coercing a numeric value: zero is coerced to `FALSE`, and any non-zero value to `TRUE`.

* `CAST(0 AS BOOL)` (false)
* `CAST(123 AS BOOL)` (true)

## Size

A `BOOL` value is 1 byte in width, but the total storage size is likely to be larger due to CockroachDB metadata.

## Examples

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> CREATE TABLE bool (a INT PRIMARY KEY, b BOOL, c BOOLEAN);
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW COLUMNS FROM bool;
```

```
  column_name | data_type | is_nullable | column_default | generation_expression |  indices  | is_hidden
--------------+-----------+-------------+----------------+-----------------------+-----------+------------
  a           | INT8      |    false    | NULL           |                       | {primary} |   false
  b           | BOOL      |    true     | NULL           |                       | {primary} |   false
  c           | BOOL      |    true     | NULL           |                       | {primary} |   false
(3 rows)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> INSERT INTO bool VALUES (12345, true, CAST(0 AS BOOL));
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SELECT * FROM bool;
```

```
+-------+------+-------+
|   a   |  b   |   c   |
+-------+------+-------+
| 12345 | true | false |
+-------+------+-------+
```

## Supported casting and conversion

`BOOL` values can be [cast](/docs/stable/data-types.md#data-type-conversions-and-casts) to any of the following data types:

| Type | Details |
| - | - |
| `INT` | Converts `true` to `1`, `false` to `0` |
| `DECIMAL` | Converts `true` to `1`, `false` to `0` |
| `FLOAT` | Converts `true` to `1`, `false` to `0` |
| `STRING` | –– |

## See also

[Data Types](/docs/stable/data-types.md)
