As we saw in the previous chapter, we can use the SELECT statement to filter our datasets using the equality condition. In the same way, we can filter records using > or < conditions, such as in the following example:
forumdb=# select * from categories where pk > 12 order by title;
pk | title | description
----+---------+-------------
14 | apricot | fruits
13 | lemon |
(2 rows)
The preceding query returns all records that have pk> 12.
Another condition that we can use with the SELECT statement is the like condition. Let's take a look at this next.
Using the like clause
Suppose we wanted to find all records that have a title field value starting with the letter 'a'.
To do this, we would have to use the like condition:
forumdb=# select * from categories where title like 'a%';
pk | title | description
----+---------+-------------
10 | apple | fruits
14 | apricot | fruits
(2 rows)
As shown, the preceding query returns...