We wish to filter rows that satisfy a logical combination of multiple conditions.
We will cover the two most common scenarios:
We wish to filter rows that meet two (or more) conditions.
In this example, we wish to filter rows of the table table_1
where the numeric column col_6
is greater than 0 and where the string column col_8
has a value that equals ‘YES’
.
SELECT *
FROM refcon.dataset.table_1
WHERE col_6 > 0
AND col_8 = 'YES';
Here is how this works:
AND
operator.We wish to filter rows that meet any one of two (or more) conditions.
In this example, we wish to filter rows of the table table_1
where the numeric column col_6
is greater than 0 or where the string column col_8
has a value that equals ‘YES’
.
SELECT *
FROM refcon.dataset.table_1
WHERE col_6 > 0
OR col_8 = 'YES'
Here is how this works:
OR
operator.