创建员工信息表

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u013796074/article/details/88856726

--创建员工信息表
create table WORKMATES 
(
P_NO number(5) ,
P_COMPANY varchar2(128) default '华为' ,
P_EMPLOYEE_ID varchar2(10) not null  ,
P_NAME varchar2(30)  ,
P_SEX varchar2(3) default '-' check(p_sex in ('男','-','女') ) ,
P_ADDR varchar2(256) default '广州' ,
P_HIREDATE date default sysdate  ,
p_MEMO varchar2(512)
) ;

--添加注释
comment on table WORKMATES is '员工信息表' ;
comment on column WORKMATES.P_NO is '员工编号' ;
comment on column WORKMATES.P_COMPANY is '所属公司' ;
comment on column WORKMATES.P_EMPLOYEE_ID is '员工工号' ;
comment on column WORKMATES.P_NAME is '员工姓名' ;
comment on column WORKMATES.P_SEX is '员工性别' ;
comment on column WORKMATES.P_ADDR is '家庭住址' ;
comment on column WORKMATES.P_HIREDATE is '雇佣日期' ;
comment on column WORKMATES.P_MEMO is '备注' ;

--增加列
alter table WORKMATES add P_IDENTIFITY_CARD number(18) default 000000000000000000 ;
alter table WORKMATES add P_DUTY varchar2(32) ;

--修改列
alter table WORKMATES modify (P_IDENTIFITY_CARD varchar2(128)) ;
comment on column WORKMATES.P_IDENTIFITY_CARD is '身份证号码'
comment on column WORKMATES.P_DUTY is '职务'

--添加主键
alter table WORKMATES add constraint PK_WORKMATES primary key (P_NO);

--begin 插入数据

insert into WORKMATES (P_NO, P_COMPANY, P_EMPLOYEE_ID, P_NAME, P_SEX, P_ADDR, P_HIREDATE, P_MEMO, P_IDENTIFITY_CARD, P_DUTY)
values (1, '易宝', 'wwx430524', '王X东', '男', '车陂南', to_date('13-06-2016', 'dd-mm-yyyy'), null, '4104821********2339', 'PL');

--end 插入数据

--查询数据

select * from WORKMATES t order by t.p_no  ;

 

 

 

 

 

 

 

 

 

 

 

 

 


 

展开阅读全文

没有更多推荐了,返回首页