What Is Bool Data Type in SQL?


Heather Bennett

What Is Bool Data Type in SQL?

In SQL, the bool data type represents a boolean value, which can be either true or false. This data type is commonly used to store logical values and is an essential component of conditional expressions and comparisons.

Creating a Bool Column

To create a bool column in a SQL table, you can use the bool data type. For example:

CREATE TABLE Customers (
    IsActive bool,

In this example, we have created a table called “Customers” with an “IsActive” column of type bool. This column will store whether a customer is active or not.

Inserting Bool Values

To insert bool values into a table, you can use the INSERT INTO statement. Here’s an example:

INSERT INTO Customers (IsActive)
VALUES (true);

In this example, we are inserting a true value into the “IsActive” column of the “Customers” table.

Retrieving Bool Values

To retrieve bool values from a table, you can use SELECT statements. Here’s an example:

FROM Customers;
  • true: If the customer is active.
  • false: If the customer is inactive.

This query will retrieve the “IsActive” values for all customers in the “Customers” table.

Filtering with Bool Values

You can also use bool values to filter SQL queries using the WHERE clause. Here’s an example:

FROM Customers
WHERE IsActive = true;

This query will retrieve all rows from the “Customers” table where the “IsActive” column is true.


The bool data type in SQL is a fundamental type used to represent boolean values. It is often utilized for storing logical values and performing conditional operations. By understanding how to create, insert, retrieve, and filter bool values, you can effectively work with boolean data in SQL.

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy