Filtering with Where

A select without any filter returns every row in the table. To narrow down results, add a where clause:

select * from main.users where id = 2;

This returns only the row where id equals 2. You can use the usual comparison operators - =, !=, <, <=, >, >=:

select * from main.users where id >= 2;

That returns Bob and Charlie, since both have an id of 2 or higher.

You can also filter on non-key fields:

select id from main.users where name = "Alice";