Home » Bigquery » Tutorials » Drop dataset

BigQuery Drop Schema

Permanently deletes a dataset and its contents

Drop dataset example

DROP SCHEMA mydataset

or

DROP SCHEMA IF EXISTS mydataset CASCADE

Explanation

  • IF EXISTS: If no dataset exists with that name, the statement has no effect.
  • dataset_name: The name of the dataset to delete.
  • CASCADE: Deletes the dataset and all resources within the dataset, such as tables, views, and functions. You must have permission to delete the resources, or else the statement returns an error
  • RESTRICT: Deletes the dataset only if it's empty. Otherwise, returns an error. If you don't specify either CASCADE or RESTRICT, then the default behavior is RESTRICT

Syntax reference

DROP SCHEMA [IF EXISTS]
[project_name.]dataset_name
[ CASCADE | RESTRICT ]