在mysql中:
-- ----------------------------
-- Table structure for `article`
-- ----------------------------
--判断表是否存在,如果存在则删除
DROP TABLE IF EXISTS `article`;
CREATE TABLE `article` (
`id` int(11) NOT NULL auto_increment,
`userid` int(11) NOT NULL,
`title` varchar(100) NOT NULL,
`content` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
在oracle中:
/*
Navicat Oracle Data Transfer
*/
------------------------------
-- Table structure for `article`
-- ----------------------------
--判断表是否存在,如果存在则删除
declare
v_exists number;
begin
select count (*) into v_exists from user_tables where table_name = 'ARTICLE';
if v_exists > 0 then
execute immediate 'drop table article';
end if;
end;
CREATE TABLE article (
id integer NOT NULL,
userid integer NOT NULL,
title varchar(100) NOT NULL,
content varchar2(100) NOT NULL,
PRIMARY KEY (id)
);