Home » Bigquery » Tutorials » Drop dataset

BigQuery Drop Schema

Permanently deletes a dataset and its contents\n\n

Drop dataset example

DROP SCHEMA mydataset
\n

or

\n
DROP SCHEMA IF EXISTS mydataset CASCADE

Explanation

    \n
  • IF EXISTS: If no dataset exists with that name, the statement has no effect.
  • \n
  • dataset_name: The name of the dataset to delete.
  • \n
  • 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
  • \n
  • 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
  • \n

Syntax reference

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