AND operator in BigQuery

The AND operator in BigQuery is used to combine two or more conditions in a WHERE or HAVING clause of a query. All the conditions combined with AND must be true for the overall condition to be true. It is used in SQL SELECT, INSERT, UPDATE, and DELETE statements.

SQL Syntax

SELECT column1, column2, ...
FROM project_name.dataset_name.table_name
WHERE condition1 AND condition2 AND ...;     

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:

AND operator in BigQuery

Let’s find the employees who are in between the Age 20 and 30. Both limits are inclusive.

SQL

SELECT *
FROM `ashishcoder.Coding_Dataset.employees`
WHERE Age BETWEEN 20 AND 30;    

The output of the above code is shown below:

AND operator in BigQuery