DROP

DROP DATABASE

DROP DATABASE drops a database. It removes the catalog entries for the database and deletes the directory containing the data.

DROP - 图1Danger

DROP DATABASE cannot be undone. Use it with care!

Syntax

  1. DROP DATABASE [ IF EXISTS ] db_name
  • IF EXISTS: Do not throw an error if the database does not exist.
  • db_name: The name of the database to remove.

Examples

To drop a database named test:

  1. DROP DATABASE test;

DROP TABLE

DROP TABLE removes tables from the database. It will remove the table definition and all table data, indexes, rules, and constraints for that table.

DROP - 图2Danger

DROP TABLE cannot be undone. Use it with care!

Syntax

  1. DROP TABLE [ IF EXISTS ] table_name
  • IF EXISTS: Do not throw an error if the table does not exist.
  • table_name: The name of the table to remove.

Examples

Drop the table monitor in the current database:

  1. DROP TABLE monitor;

DROP FLOW

  1. DROP FLOW [ IF EXISTS ] flow_name;
  • IF EXISTS: Do not throw an error if the flow does not exist.
  • flow_name: The name of the flow to destroy.
  1. DROP FLOW IF EXISTS test_flow;
  1. Query OK, 0 rows affected (0.00 sec)

DROP VIEW

  1. DROP VIEW [ IF EXISTS ] view_name;
  • IF EXISTS: Do not throw an error if the view does not exist.
  • view_name: The name of the view to remove.
  1. DROP VIEW IF EXISTS test_view;
  1. Query OK, 0 rows affected (0.00 sec)