NOT operator in BigQuery

The NOT operator in BigQuery is used to negate a condition. It returns TRUE if the condition it negates is FALSE, and vice versa. The NOT operator can be used with various other SQL operators to create more complex conditions in a WHERE clause.

SQL Syntax

SELECT column_name(s)
FROM `project_name.dataset_name.table_name`
WHERE NOT condition;    

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:

NOT operator in BigQuery

Let’s find the employees whose Age is not greater than 30.

SQL

SELECT *
FROM `ashishcoder.Coding_Dataset.employees`
WHERE NOT Age > 30;    

The output of the above query is shown below:

NOT operator in BigQuery