SQL要从A数据库中删除一个表B,要输入什么命令执行?

SQL要从A数据库中删除一个表B,要输入什么命令执行?,第1张

SQL 关键字 Drop Table

假如删除表B,SQL如下:

drop table B

以上SQL 就会把表B 从A 数据库中删除

drop table *** 作存在风险,请慎重 *** 作。

--创建测试表

create table t_a(id int,name varchar(10))

create table t_b(id int,name varchar(10))

--测试数据

insert into t_a(id,name) values (1,'a')

--创建 for delete 触发器

create trigger trg_t_a_1

on t_a

for delete

as

begin

insert into t_b

select id,name from deleted

end

--从t_a中删除一条数据

delete from t_a where id=1

delete '临时表名' where (e,f,g) in(select b,c,d from Test)

改成

delete '临时表名' where (e,f,g) in(select x.e,x.f,x.g from '临时表名' x,Test y where x.e=y.b and x.f=y.c and x.g=y.d)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/6697879.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-26
下一篇 2023-03-26

发表评论

登录后才能评论

评论列表(0条)

保存