加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

oracle数据库scott用户下emp和dept表数据

发布时间:2020-12-12 14:30:56 所属栏目:百科 来源:网络整理
导读:create table DEPT ( DEPTNO number(2) not null, DNAME varchar(14), LOC varchar(13) ) ; alter table DEPT add constraint PK_DEPT primary key (DEPTNO); create table EMP ( EMPNO number(4) not null, ENAME varchar(10), JOB varchar(9), MGR number(

create table DEPT

(

DEPTNO number(2) not null,

DNAME varchar(14),

LOC varchar(13)

)

;

alter table DEPT

add constraint PK_DEPT primary key (DEPTNO);


create table EMP

(

EMPNO number(4) not null,

ENAME varchar(10),

JOB varchar(9),

MGR number(4),

HIREDATE date,

SAL number(7 ),

COMM number(7 ),

DEPTNO number(2)

)

;

alter table EMP

add constraint PK_EMP primary key (EMPNO);

alter table EMP

add constraint FK_DEPTNO foreign key (DEPTNO)

references DEPT (DEPTNO);


insert into DEPT (DEPTNO,DNAME,LOC)

values (10,'ACCOUNTING','NEW YORK');

insert into DEPT (DEPTNO,LOC)

values (20,'RESEARCH','DALLAS');

insert into DEPT (DEPTNO,LOC)

values (30,'SALES','CHICAGO');

insert into DEPT (DEPTNO,LOC)

values (40,'OPERATIONS','BOSTON');

commit;


insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO)

values (7369,'SMITH','CLERK',7902,to_date('1980-12-17','YYYY-MM-DD'),800,null,20);

insert into EMP (EMPNO,DEPTNO)

values (7499,'ALLEN','SALESMAN',7698,to_date('1981-02-20',1600,300,30);

insert into EMP (EMPNO,DEPTNO)

values (7521,'WARD',to_date('1981-02-22',1250,500,DEPTNO)

values (7566,'JONES','MANAGER',7839,to_date('1981-04-02',2975,DEPTNO)

values (7654,'MARTIN',to_date('1981-09-28',1400,DEPTNO)

values (7698,'BLAKE',to_date('1981-05-01',2850,DEPTNO)

values (7782,'CLARK',to_date('1981-06-09',2450,10);

insert into EMP (EMPNO,DEPTNO)

values (7788,'SCOTT','ANALYST',7566,to_date('1987-04-19',3000,DEPTNO)

values (7839,'KING','PRESIDENT',to_date('1981-11-17',5000,DEPTNO)

values (7844,'TURNER',to_date('1981-09-08',1500,DEPTNO)

values (7876,'ADAMS',7788,to_date('1987-05-23',1100,DEPTNO)

values (7900,'JAMES',to_date('1981-12-03',950,DEPTNO)

values (7902,'FORD',to_date('1981-12-02',DEPTNO)

values (7934,'MILLER',7782,to_date('1982-01-23',1300,10);

commit;


来自:http://blog.sina.com.cn/s/blog_6d76c7e20102v081.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读