mysql和oracle建表语句的区别
Posted 雪儿
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql和oracle建表语句的区别相关的知识,希望对你有一定的参考价值。
mysql
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`number` varchar(255) NOT NULL COMMENT ‘工单编号‘,
`applicant` varchar(255) NOT NULL COMMENT ‘工单申请人‘,
`state` int(1) NOT NULL COMMENT ‘工单状态‘,
`count` int(4) NOT NULL COMMENT ‘个数‘,
`ctime` varchar(255) NOT NULL,
`depart` varchar(255) NOT NULL COMMENT ‘部门‘,
`projectname` varchar(255) NOT NULL COMMENT ‘项目名称‘,
PRIMARY KEY (`id`),
UNIQUE KEY `index_id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8;
oracle
---创建表
create table ZHANGSAN.ORDER
(
id NUMBER not null,
number VARCHAR2(255),
applicant VARCHAR2(255),
state NUMBER(1),
count NUMBER(6),
ctime VARCHAR2(30),
depart VARCHAR2(255),
projectname VARCHAR2(255)
)
---为每一行添加注释
comment on column ZHANGSAN.ORDER.number
is ‘工单编号‘;
comment on column ZHANGSAN.ORDER.applicant
is ‘工单申请人‘;
comment on column ZHANGSAN.ORDER.state
is ‘工单状态‘;
comment on column ZHANGSAN.ORDER.count
is ‘个数‘;
comment on column ZHANGSAN.ORDER.ctime
is ‘创建时间‘;
comment on column ZHANGSAN.ORDER.depart
is ‘部门‘;
comment on column ZHANGSAN.ORDER.projectname
is ‘项目名称‘;
---指定主键
alter table ZHANGSAN.ORDER
add constraint ID primary key (ID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255;
以上是关于mysql和oracle建表语句的区别的主要内容,如果未能解决你的问题,请参考以下文章
mysql数据库的SQL语句和oracle的有啥区别?详细点