google-big-queryHow do I use the YEAR function in Google BigQuery?
The YEAR function in Google BigQuery is used to extract the year from a date or timestamp expression. It takes in one parameter, which is a date or timestamp expression. The output of the YEAR function is an integer between 1 and 9999.
SELECT YEAR('2015-06-13') as year;
The output of this query will be:
The parts of the code are:
SELECT: This is a keyword used to indicate that a query is being executed
YEAR('2015-06-13'): This is the YEAR function, taking in the date '2015-06-13' as a parameter
as year: This is an alias for the output of the query, which will be stored in the column 'year'
More of Google Big Query
- How do I set up a Google Big Query zone?
- How can I use the CASE WHEN statement in Google Big Query?
- How can I use IFNULL in Google BigQuery?
- ¿Cuáles son las ventajas y desventajas de usar Google BigQuery?
- How can I use Google Big Query to process XML data?
- How can I use Google BigQuery to wait for a query to complete?
- How do I use Google Big Query to zip files?
- How do I use wildcards in Google BigQuery?
- How can I use Google BigQuery to access Wikipedia data?
See more codes...