欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

DROP TABLE在不同数据库中的写法整理

程序员文章站 2022-06-09 09:22:20
drop table在不同数据库中的写法整理 1,mysql中 drop table if exists [table_name] 2,oracle中:...

drop table在不同数据库中的写法整理

1,mysql中

drop table if exists [table_name]

2,oracle中:

begin
  execute immediate 'drop table [table_name]';
  exception when others then null;
end;

3,在sql server中

if exists (
  select table_name from information_schema.tables
  where  table_name = '[table_name]')
drop table [table_name]

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!