Drop Databases and Tables
Before performing operations, verify that you have the necessary permissions. For more information, refer to User Access Control.
Drop Databases
Use SQL DROP DATABASE statement or the dropDatabase function to delete distributed databases.
For example, drop the existing distributed database dfs://demo.
db = database("dfs://demo", VALUE, 1..5)
// use SQL DROP
drop database "dfs://demo"
// or use the dropDatabase function
dropDatabase("dfs://demo")
Drop Tables
Drop DFS Tables
Use SQL DROP TABLE statement or the dropTable function to delete specified DFS tables from a database.
For example, drop table demoTable from database dfs://demo.
db = database("dfs://demo", VALUE, 1..5)
schemaTb = table(1:0,`id`name`val,[INT,SYMBOL,DOUBLE])
pt = db.createPartitionedTable(schemaTb,`demoTable,`id)
// use SQL DROP
drop table "dfs://demo"."demoTable"
// or use the dropTable function
dropTable(db,"demoTable")
Drop In-memory Tables
Use SQL DROP TABLE statement or the undef function to delete specified in-memory tables.
For example, drop table t.
t = table(1:0,`id`name`val,[INT,SYMBOL,DOUBLE])
// use SQL DROP TABLE
drop table t
// or use the undef function
undef("t")
To remove a shared in-memory table, specify the parameter
objType=SHARED in the undef
function:
share table(1:0,`id`name`val,[INT,SYMBOL,DOUBLE]) as t
undef(obj="t", objType=SHARED)
For stream tables, use the dropStreamTable function:
t = streamTable(1:0,`id`name`val,[INT,SYMBOL,DOUBLE])
dropStreamTable("t")