-- 删除库
drop database [if exists] db_name;
-- 强制删除库
drop database [if exists] db_name cascade;
-- 删除表
drop table [if exists] table_name;
-- 清空表,第二种方式
insert overwrite table_name select * from table_name where 1=0;
-- 删除分区
alter table table_name drop [if exists] partition (dt='2019-01-01');
alter table table_name drop [if exists] partition (dt>='2019-01');

本文详细介绍如何使用SQL语句进行数据库操作,包括删除数据库、表、清空表数据、删除分区等核心操作。对于数据库管理员和开发者来说,掌握这些基本的SQL命令是必不可少的。
1985

被折叠的 条评论
为什么被折叠?



