Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Combine "Year", "Month", and "Day" columns in Biqquery to a Date column

I am new to the bigquery. I was looking into the public dataset gsod, which has three different columns, i.e., year, month, and day. Can I change this to a single column called date in format yyyy-mm-dd?

I saw you could do something like

SELECT
  DATE(2016, 12, 25) AS date_ymd

But how do I pass columns inside DATE instead of a single value? I want to combine the query with the following simple query and get a column called date.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

SELECT
*,
FROM `bigquery-public-data.samples.gsod`

>Solution :

Use below

SELECT date(year, month, day) as date_ymd, *
FROM `bigquery-public-data.samples.gsod` 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading