# bool

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: bool
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/sql-data-types/bool
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/sql-data-types/bool.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-data-types/bool.adoc
description: "`bool` is a data type for expressions that return one of two possible values: true or false."
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-data-types/bool.md -->

## [](#overview)Overview

A `bool` is a data type for expressions that return one of two possible values: `true` or `false`.

> ⚠️ **WARNING**
>
> `BOOLEAN` is an alias for the `bool` data type. You can create a table using `BOOLEAN`, but Redpanda SQL stores and processes the values as `bool`.

## [](#format)Format

-   `FALSE`

-   `TRUE`


## [](#examples)Examples

The following are examples of using a bool data type:

### [](#create-a-table)Create a table

The following example creates a `borrowBook` table to store book borrowing records. The table contains columns for the borrow ID, book name, borrower, and a `bool` column for the returned status.

```sql
CREATE TABLE borrowBook  (
   borrowID INT,
   bookName TEXT,
   borrower TEXT,
   returnedStat BOOL NOT NULL
);
INSERT INTO borrowBook (borrowID,bookName, borrower, returnedStat)
VALUES
    (101, 'The Silent Patient', 'Mike', TRUE),
    (201, 'Malibu Rising', 'Jean', TRUE),
    (301, 'The Guest List', 'Mark', FALSE),
    (401, 'The Four Winds', 'Cliff', TRUE),
    (501, 'The Vanishing Half: A Novel', 'Sarah', TRUE),
    (601, 'Red, White & Royal Blue', 'Anna', FALSE),
    (701, 'The Duke and I', 'Blake', FALSE),
    (801, 'The Lord of the Rings', 'Sandra', FALSE);
```

The `borrowBook` table has been successfully created after executing the query:

```sql
COMPLETE
INSERT 0 8
```

### [](#display-the-table)Display the table

Run the `SELECT` statement to get all records from the `borrowBook` table:

```sql
SELECT * FROM borrowBook;
```

This returns the following result:

```sql
+-----------+---------------------------------+------------+---------------+
| borrowid  | bookname                        | borrower   | returnedstat  |
+-----------+---------------------------------+------------+---------------+
| 101       | The Silent Patient              | Mike       | t             |
| 201       | Malibu Rising                   | Jean       | t             |
| 301       | The Guest List                  | Mark       | f             |
| 401       | The Four Winds                  | Cliff      | t             |
| 501       | The Vanishing Half: A Novel     | Sarah      | t             |
| 601       | Red, White & Royal Blue         | Anna       | f             |
| 701       | The Duke and I                  | Blake      | f             |
| 801       | The Lord of the Rings           | Sandra     | f             |
+-----------+---------------------------------+------------+---------------+
```

### [](#list-of-the-returned-books)List of the returned books

This example retrieves all the books that have already been returned:

```sql
SELECT * FROM borrowbook
WHERE returnedstat = TRUE;
```

The query returns the following results:

```sql
+-----------+---------------------------------+------------+---------------+
| borrowid  | bookname                        | borrower   | returnedstat  |
+-----------+---------------------------------+------------+---------------+
| 101       | The Silent Patient              | Mike       | t             |
| 201       | Malibu Rising                   | Jean       | t             |
| 401       | The Four Winds                  | Cliff      | t             |
| 501       | The Vanishing Half: A Novel     | Sarah      | t             |
+-----------+---------------------------------+------------+---------------+
```

### [](#list-of-the-unreturned-books)List of the unreturned books

To acquire all of the book records that haven’t been returned yet, run the `SELECT` statement with a specified `WHERE` condition as `false`:

```sql
SELECT * FROM borrowbook
WHERE returnedstat = FALSE;
```

The query returns the following results:

```sql
+-----------+---------------------------------+------------+---------------+
| borrowid  | bookname                        | borrower   | returnedstat  |
+-----------+---------------------------------+------------+---------------+
| 301       | The Guest List                  | Mark       | f             |
| 601       | Red, White & Royal Blue         | Anna       | f             |
| 701       | The Duke and I                  | Blake      | f             |
| 801       | The Lord of the Rings           | Sandra     | f             |
+-----------+---------------------------------+------------+---------------+
```

### [](#check-a-books-return-status)Check a book’s return status

This example finds the returned status of the book "The Lord of the Rings" by executing the `SELECT` statement with a specified column in the `WHERE` clause:

```sql
SELECT * FROM borrowbook
WHERE bookname = 'The Lord of the Rings';
```

This query filters all records based on the specified conditions, showing that Sandra hasn’t returned the book yet:

```sql
+-----------+---------------------------------+------------+---------------+
| borrowid  | bookname                        | borrower   | returnedstat  |
+-----------+---------------------------------+------------+---------------+
| 801       | The Lord of the Rings           | Sandra     | f             |
+-----------+---------------------------------+------------+---------------+
```