Home » Bigquery » Tutorials » Create dataset

BigQuery Create new schema

Dataset is the same as a database.Dataset is a collection of db objects (tables, views, routines,..). To create a new dataset in BigQuery use the create schema command

Create dataset example

CREATE SCHEMA mydatasetname
    OPTIONS(
      location="us"
      )

Create dataset with table expiration

    CREATE SCHEMA mydataset
    OPTIONS(
      location="us",
      default_table_expiration_days=30
      )

Explanation

The Create Schema command creates a new dataset in BigQuery. You can also specify the below additional options

  • default_kms_key_name
  • default_partition_expiration_days
  • default_table_expiration_days
  • description
  • friendly_name
  • labels
  • location

Syntax reference

CREATE SCHEMA [IF NOT EXISTS]
[project_name.]dataset_name
[OPTIONS(schema_option_list)]