DB2建表实例

CREATE TABLE SEAT_[].TM_SEAT_CONDITION
(
CON_ID INTEGER NOT NULL,
AIRLINE VARCHAR(3) NOT NULL,
FLT_REG VARCHAR(5) NOT NULL, 
SEATS VARCHAR(2000) NOT NULL,
ATTRIBUTE VARCHAR(4),
FAULT_TYPE VARCHAR(2),
REASON VARCHAR(100),
EFFECTIVE_DATE DATE NOT NULL,
EXPIRY_DATE DATE NOT NULL,
NOTE VARCHAR(1000),
CREATE_TIME TIMESTAMP NOT NULL,
CREATE_USER VARCHAR(50) NOT NULL,
UPDATE_TIME TIMESTAMP NOT NULL,
UPDATE_USER VARCHAR(50) NOT NULL,
MARK_FOR_DELETE CHAR(1) NOT NULL
)
DATA CAPTURE NONE 
IN SEAT_[]_DAT_32K INDEX IN SEAT_[]_IDX_4K
COMPRESS NO;

ALTER TABLE SEAT_[].TM_SEAT_CONDITION ADD CONSTRAINT PK_TM_SEAT_CONDITION PRIMARY KEY(CON_ID);
GRANT DELETE ON TABLE "SEAT_[]"."TM_SEAT_CONDITION" TO ROLE "R_UPDSEAT_[]";
GRANT INSERT ON TABLE "SEAT_[]"."TM_SEAT_CONDITION" TO ROLE "R_UPDSEAT_[]";
GRANT SELECT ON TABLE "SEAT_[]"."TM_SEAT_CONDITION" TO ROLE "R_SELSEAT_[]";
GRANT UPDATE ON TABLE "SEAT_[]"."TM_SEAT_CONDITION" TO ROLE "R_UPDSEAT_[]";

CREATE SEQUENCE SEAT_[].TM_SEAT_CONDITION_SEQ AS BIGINT START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 NO CYCLE CACHE 1000 NO ORDER;
GRANT ALTER ON SEQUENCE "SEAT_[]"."TM_SEAT_CONDITION_SEQ" TO ROLE "R_UPDSEAT_[]";
GRANT USAGE ON SEQUENCE "SEAT_[]"."TM_SEAT_CONDITION_SEQ" TO ROLE "R_SELSEAT_[]";

COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.CON_ID IS ‘主键‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.AIRLINE IS ‘航空公司‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.FLT_REG IS ‘飞机注册号‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.SEATS IS ‘坏座位编号,用逗号分割‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.ATTRIBUTE IS ‘锁属性‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.FAULT_TYPE IS ‘故障类型‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.REASON IS ‘原因说明‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.EFFECTIVE_DATE IS ‘起效日期‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.EXPIRY_DATE IS ‘失效日期‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.NOTE IS ‘备注‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.CREATE_TIME IS ‘创建时间,精确到秒‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.CREATE_USER IS ‘创建者‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.UPDATE_TIME IS ‘更新时间,精确到秒‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.UPDATE_USER IS ‘更新者‘;
COMMENT ON COLUMN SEAT_[].TM_SEAT_CONDITION.MARK_FOR_DELETE IS ‘逻辑删除,Y/N‘;

时间: 2024-09-30 03:06:28

DB2建表实例的相关文章

(原创)hibernate 一对多建表实例详解 附上各个注释的含义

这个是hibernate的一对多建表实例:一的一端是部门(Department),对的一端是员工(Employee),下面贴上成员源代码:其中@mappedBy是加在@OneToMany一端,并且它的name属性=多的那一端(N端)属性是一的那一端的属性名,mappedBy是定义在Department类中,即Department类不负责维护级联关系.即维护者是Employee类 Department类: package com.javabean; import java.io.Serializa

DB2建表语句

db2 => create table test (name char(8) not null primary key,depid smallint,pay bigint) DB20000I SQL 命令成功完成. db2 => create table test1 (name char(8) not null primary key,depid smallint references department (depid),pay bigint) DB20000I SQL 命令成功完成. db

mysql数据库建库建表实例

一.实例. drop database if exists school; //如果存在SCHOOL则删除create database school; //建立库SCHOOLuse school; //打开库SCHOOLcreate table teacher //建立表TEACHER(    id int(3) auto_increment not null primary key,    name char(10) not null,    address varchar(50) defa

简单的hbase建表实例

package cn.itcast.hbase; //import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;

oracle建表实例

-- -------------------------------------------------- -- Generated by Enterprise Architect Version 9.2.921-- Created On : 星期一, 06 六月, 2016 -- DBMS : Oracle -- -------------------------------------------------- -- Create Tables CREATE TABLE CSTL_ASM_C

DB2 建表,添加字段,删除字段,修改字段等常用操作

转载:http://blog.sina.com.cn/s/blog_67aaf4440100v01p.html,稍作修改. --创建数据库 create database Etp; --连接数据库 connect to Etp; --断开连接 disconnect Etp; --查看当前数据库下有哪些表 list tables; --删除表 drop table studentinfo; --创建表的同时添加约束方式1 create table studentinfo( stuNo int no

DB2建表

create table P_User(             ID integer not null primary key,             Name varchar(60),             SEX varchar(3),             TELEPHONE varchar(20),             ADDRESS varchar(50),             cellphone varchar(20)      )

如何在数据库动态建表

动态建表首先需要了解Statement类 Statement 对象用 Connection 的方法createStatement 创建,例如 //创建连接对象Connection connection = DBUtil.getConnection();//创建Statement对象Statement statement=connection.createStatement(); 创建完之后通过执行以sql语句为参数的Statement的方法,来执行sql语句完成对数据库的操作. Statemen

(笔记)Mysql实例:建库建表并插入数据2

drop database if exists school;  // 如果存在SCHOOL则删除create database school;  // 建立库SCHOOLuse school;  // 打开库SCHOOLcreate table teacher(  // 建立表TEACHER    id int(3) auto_increment not null primary key,    name char(10) not null,    address varchar(50) de