CONCAT in BigQuery SQL
How to use the String Function in Google’s BigQuery
As a developer or as a data scientist and analyst, you will stumble over strings again and again in BigQuery and other SQL-based topics. One popular function is CONCAT
. This article provides a short overview of the function.
CONCAT
It concatenates one or more values to a single result. All values must be BYTES
or data types that can be converted to STRING
. The function returns NULL
if any of the input arguments is NULL
. I use this function fairly often, for example to create new attributes in the data integration process [1].
With the following query,
SELECT CONCAT(“Con”, “Cat”) as Result;
we will get the following result:
CONCAT with UNION
Conveniently, you can also use this with tables and columns that you connect via a UNION
.
With Employees AS (SELECT ‘Alice’ AS first_name, ‘Schmidt’ AS last_name UNION ALL