Where

Filters binding tuples by boolean predicate (residual scan filter).

Constant True

Constant true keeps all rows.

SQL

create table T;

insert into T ({x: 1}, {x: 2});

select * from T where true;

Result

[
  { "x": 1 },
  { "x": 2 }
]

Constant False

Constant false drops all rows.

SQL

create table T;

insert into T ({x: 1});

select * from T where false;

Result

[]

Null Predicate

Null predicate is not-true and drops all rows.

SQL

create table T;

insert into T ({x: 1});

select * from T where null;

Result

[]

Numeric Greater-than

Numeric greater-than filters by oid insertion order.

SQL

create table T;

insert into T ({x: 1}, {x: 2}, {x: 3});

select * from T where T.x > 1;

Result

[
  { "x": 2 },
  { "x": 3 }
]

Numeric Equality

Numeric equality matches a single row.

SQL

create table T;

insert into T ({x: 1}, {x: 2}, {x: 3});

select * from T where T.x = 2;

Result

[
  { "x": 2 }
]

Numeric Inequality

Numeric inequality excludes matching value.

SQL

create table T;

insert into T ({x: 1}, {x: 2}, {x: 3});

select * from T where T.x != 1;

Result

[
  { "x": 2 },
  { "x": 3 }
]

String Equality

String equality in where.

SQL

create table T;

create table S;

insert into S ({name: 'alice'}, {name: 'bob'});

select * from S where S.name = 'bob';

Result

[
  { "name": "bob" }
]

Boolean Equality

Boolean equality in where.

SQL

create table T;

insert into T ({flag: true}, {flag: false});

select * from T where T.flag = true;

Result

[
  { "flag": true }
]

Predicate May

Predicate may use an explicit from alias.

SQL

create table T;

insert into T ({x: 0}, {x: 1});

select * from T as t where t.x > 0;

Result

[
  { "x": 1 }
]

Null Member

Null member compares equal to null.

SQL

create table T;

insert into T ({x: null});

select * from T where T.x = null;

Result

[
  { "x": null }
]

Null Member

Null member fails inequality against non-null.

SQL

create table T;

insert into T ({x: null});

select * from T where T.x != 1;

Result

[]

Absent Field

Absent field reads as null and matches null.

SQL

create table T;

insert into T ({});

select * from T where T.x = null;

Result

[
  {  }
]

Absent Field

Absent field reads as null and fails ordering comparison.

SQL

create table T;

insert into T ({});

select * from T where T.x > 0;

Result

[]

Only Rows

Only rows with present matching field pass equality.

SQL

create table T;

insert into T ({x: 1}, {});

select * from T where T.x = 1;

Result

[
  { "x": 1 }
]

Scalar Projection

Scalar projection with where (moved from from-clause suite).

SQL

create table T;

insert into T ({x: 1}, {x: 2}, {x: 3});

select T.x from T where T.x > 1;

Result

[
  2,
  3
]