Exploring the SELECT statement
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 > 2;
pk | title | description
----+-----------------------+---------------------------------
3 | Programming Languages | All about programming languages
(1 row)
The preceding query returns all records that have pk > 2
.
Another condition that we can use with the SELECT
statement is the like
condition. Let’s take a look at this next.