Where Clause
We often select only a portion of out huge database. For example, we will use table from last article and we would like to select only students with bikes. Let’s do it.
id | name | surname | date_of_birth | has_bicycle |
1 | John | Smith | 1995/05/15 | true |
2 | Alex | Hunnybun | 2004/01/19 | false |
3 | Carol | Gladden | 2005/10/13 | true |
SELECT id FROM students WHERE has_bicycle = true;
The result:
id |
1 |
3 |
Examples of another where clause uses:
SELECT * FROM students WHERE surname = 'Smith';
SELECT * FROM students WHERE id = 1;
SELECT * FROM students WHERE date_of_birth < '2005/01/01';