Oracle標準建表語句

2021-09-25 19:21:10 字數 1688 閱讀 8862

--create table 建表

create table outln.customer(

id varchar2(32) default sys_guid() not null,

cust_id varchar2(64),

cust_name varchar2(255),

id_no varchar2(64),

mobile varchar2(16),

created_by varchar2(100) default 'sys',

date_created date default sysdate,

updated_by varchar2(100) default 'sys',

date_updated date default sysdate

)monitoring,initrans 6;

-- add comments to the table 新增注釋

comment on table outln.customer is '客戶資訊表';

-- add comments to the columns

comment on column outln.customer.id is '主鍵id';

comment on column outln.customer.cust_id is '系統名單唯一標示';

comment on column outln.customer.cust_name is '客戶姓名';

comment on column outln.customer.id_no is '身份證號';

comment on column outln.customer.mobile is '客戶手機號';

comment on column outln.customer.created_by is '建立人';

comment on column outln.customer.date_created is '建立時間';

comment on column outln.customer.updated_by is '更新人';

comment on column outln.customer.date_updated is '更新時間';

-- create/recreate indexes 建立索引

create index outln.idx_customer_mobile on outln.customer (mobile) initrans 16;

-- create/recreate primary index 建立唯一索引

create unique index outln.idx_customer_customer_id_no on outln.customer (id_no) initrans 16;

-- create/recreate primary constraints 建立主鍵

alter table outln.customer add constraint pk_customer_customer primary key (id) using index outln.idx_customer_customer;

-- create synonym 建立同義詞

create public synonym customer for outln.customer;

Oracle 建表語句

create table table name id numner 12 text verchar2 255char not null char型別,乙個漢字佔乙個長度 pid varchar2 32 byte notnull byte型別,utf8乙個漢字佔大約兩個長度 status number...

PostgreSQL標準建表語句

建表 create table if not exists public.user id character varying 32 not null default sys guid name character varying 100 not null,gender character varyi...

MySQL最標準建表語句

sql分類 ddl 資料定義語言 dml 資料操縱語言 dcl 資料控制語言 create table t wxuser trade log id int 11 not null auto increment comment 序號 order id bigint 20 not null commen...