Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Booleans

The bool type represents a type that has the values true, false, or null.

For backward compatibility with SQL, BOOLEAN is a syntactic alias for type bool.

Examples


Comparisons produces Boolean values

# spq
values 1==1, 1>2
# input

# expected output
true
false

Booleans are used as predicates

# spq
values 1==1, 1>2
# input

# expected output
true
false

Booleans operators perform logic on Booleans

# spq
values {and:a and b, or:a or b}
# input
{a:false,b:false}
{a:false,b:true}
{a:true,b:true}
# expected output
{and:false,or:false}
{and:false,or:true}
{and:true,or:true}

Boolean aggregate functions

# spq
aggregate andA:=and(a), andB:=and(b), orA:=or(a), orB:=or(b)
# input
{a:false,b:false}
{a:false,b:true}
# expected output
{andA:false,andB:false,orA:false,orB:true}