CONCAT in BigQuery SQL

How to use the String Function in Google’s BigQuery

Christianlauer
CodeX

--

Photo by Madrona Rose on Unsplash

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 NULLif 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:

Result — Image by Author

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

--

--

Christianlauer
CodeX
Editor for

Big Data Enthusiast based in Hamburg and Kiel. Thankful if you would support my writing via: https://christianlauer90.medium.com/membership