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\n    OPTIONS(\n      location="us"\n      )\n
\n\n

Create dataset with table expiration

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

Explanation

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

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

Syntax reference

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