

# Boolean type
<a name="s_Boolean_type"></a>

Use the BOOLEAN data type to store true and false values in a single-byte column. The following table describes the three possible states for a Boolean value and the literal values that result in that state. Regardless of the input string, a Boolean column stores and outputs "t" for true and "f" for false. 

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/clean-rooms/latest/sql-reference/s_Boolean_type.html)

You can use an IS comparison to check a Boolean value only as a predicate in the WHERE clause. You can't use the IS comparison with a Boolean value in the SELECT list.

## Examples
<a name="Boolean_type-examples"></a>

You can use a BOOLEAN column to store an "Active/Inactive" state for each customer in a CUSTOMER table.

```
select * from customer;
custid | active_flag
-------+--------------
   100 | t
```

In this example, the following query selects users from the USERS table who like sports but do not like theatre: 

```
select firstname, lastname, likesports, liketheatre
from users
where likesports is true and liketheatre is false
order by userid limit 10;

firstname |  lastname  | likesports | liketheatre
----------+------------+------------+-------------
Alejandro | Rosalez    | t          | f
Akua      | Mansa      | t          | f
Arnav     | Desai      | t          | f
Carlos    | Salazar    | t          | f
Diego     | Ramirez    | t          | f
Efua      | Owusu      | t          | f
John      | Stiles     | t          | f
Jorge     | Souza      | t          | f
Kwaku     | Mensah     | t          | f
Kwesi     | Manu       | t          | f
(10 rows)
```

The following example selects users from the USERS table for whom is it unknown whether they like rock music.

```
select firstname, lastname, likerock
from users
where likerock is unknown
order by userid limit 10;

firstname | lastname | likerock
----------+----------+----------
Alejandro | Rosalez   |      
Carlos    | Salazar   |      
Diego     | Ramirez   |  
John      | Stiles    |      
Kwaku     | Mensah    |  
Martha    | Rivera    |  
Mateo     | Jackson   |      
Paulo     | Santos    | 
Richard   | Roe       |      
Saanvi    | Sarkar    |
(10 rows)
```

The following example returns an error because it uses an IS comparison in the SELECT list.

```
select firstname, lastname, likerock is true as "check"
from users
order by userid limit 10;

[Amazon](500310) Invalid operation: Not implemented
```

The following example succeeds because it uses an equal comparison ( = ) in the SELECT list instead of the IS comparison.

```
select firstname, lastname, likerock = true as "check"
from users
order by userid limit 10;

firstname | lastname  | check
----------+-----------+------
Alejandro | Rosalez   |      
Carlos    | Salazar   |      
Diego     | Ramirez   | true 
John      | Stiles    |      
Kwaku     | Mensah    | true 
Martha    | Rivera    | true 
Mateo     | Jackson   |      
Paulo     | Santos    | false
Richard   | Roe       |      
Saanvi    | Sarkar    |
```

# Boolean literals
<a name="Boolean_literals-spark"></a>

The following rules are for working with Boolean literals that are supported by AWS Clean Rooms Spark SQL.

Use a Boolean literal to specify a Boolean value, such as `TRUE` or `FALSE`. 

## Syntax
<a name="boolean_literals_syntax"></a>

```
TRUE | FALSE
```

## Example
<a name="boolean_literals_example"></a>

The following example shows a column with a specified value of `TRUE` .

```
SELECT TRUE AS col;
+----+
| col|
+----+
|true|
+----+
```