码迷,mamicode.com
首页 > 数据库 > 详细

mysql和oracle建表语句的区别

时间:2018-07-03 16:38:15      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:auto   nbsp   语句   mysq   primary   order   char   strong   nod   

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建表语句的区别

标签:auto   nbsp   语句   mysq   primary   order   char   strong   nod   

原文地址:https://www.cnblogs.com/xueershewang/p/9258955.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!