WHERE clause in BigQuery

The WHERE clause in BigQuery is used to filter records that meet a specified condition.

SQL Syntax

SELECT *
FROM table_name
WHERE column_name operator 'value';    

Note: The value can be text or numeric. If it is a text value, it must be enclosed in single quotes. For numeric values, quotes are not required.

Example: Let’s have the Employees table. To view all the records, execute the following query.

SQL

SELECT * FROM `ashishcoder.Coding_Dataset.employees`;   

The output of the above query is shown below:

WHERE clause in BigQuery

Basic WHERE Clause

Select employees with a salary greater than 20,000.

SQL

SELECT *
FROM `ashishcoder.Coding_Dataset.employees`
WHERE Salary > 20000;    

The result of the above query is shown below:

WHERE clause in BigQuery