數據庫練習經典表‘dept’+‘emp’的sql語句
阿新 • • 發佈:2018-12-19
earch isa pan ott reside edate 經典 table ner
數據庫練習經典表‘dept’+‘emp’的sql語句
1 create table emp ( 2 empno numeric(4) not null, 3 ename varchar(10), 4 job varchar(9), 5 mgr numeric(4), 6 hiredate datetime, 7 sal numeric(7, 2), 8 comm numeric(7, 2), 9 deptno numeric(2) 10 ); 11 12 insert into emp values (7369, ‘SMITH‘, ‘CLERK‘, 7902, ‘1980-12-17‘, 800, null, 20); 13 insert into emp values (7499, ‘ALLEN‘, ‘SALESMAN‘, 7698, ‘1981-02-20‘, 1600, 300, 30); 14 insert into emp values (7521, ‘WARD‘, ‘SALESMAN‘, 7698, ‘1981-02-22‘, 1250, 500, 30); 15 insert into emp values (7566, ‘JONES‘, ‘MANAGER‘, 7839, ‘1981-04-02‘, 2975, null, 20);16 insert into emp values (7654, ‘MARTIN‘, ‘SALESMAN‘, 7698, ‘1981-09-28‘, 1250, 1400, 30); 17 insert into emp values (7698, ‘BLAKE‘, ‘MANAGER‘, 7839, ‘1981-05-01‘, 2850, null, 30); 18 insert into emp values (7782, ‘CLARK‘, ‘MANAGER‘, 7839, ‘1981-06-09‘, 2450, null, 10); 19 insert into emp values (7788, ‘SCOTT‘, ‘ANALYST‘, 7566, ‘1982-12-09‘, 3000, null, 20); 20 insert into emp values (7839, ‘KING‘, ‘PRESIDENT‘, null, ‘1981-11-17‘, 5000, null, 10); 21 insert into emp values (7844, ‘TURNER‘, ‘SALESMAN‘, 7698, ‘1981-09-08‘, 1500, 0, 30); 22 insert into emp values (7876, ‘ADAMS‘, ‘CLERK‘, 7788, ‘1983-01-12‘, 1100, null, 20); 23 insert into emp values (7900, ‘JAMES‘, ‘CLERK‘, 7698, ‘1981-12-03‘, 950, null, 30); 24 insert into emp values (7902, ‘FORD‘, ‘ANALYST‘, 7566, ‘1981-12-03‘, 3000, null, 20); 25 insert into emp values (7934, ‘MILLER‘, ‘CLERK‘, 7782, ‘1982-01-23‘, 1300, null, 10); 26 27 create table dept ( 28 deptno numeric(2), 29 dname varchar(14), 30 loc varchar(13) 31 ); 32 33 insert into dept values (10, ‘ACCOUNTING‘, ‘NEW YORK‘); 34 insert into dept values (20, ‘RESEARCH‘, ‘DALLAS‘); 35 insert into dept values (30, ‘SALES‘, ‘CHICAGO‘); 36 insert into dept values (40, ‘OPERATIONS‘, ‘BOSTON‘); 37 38 create table bonus ( 39 empno numeric(4), 40 job varchar(9), 41 sal numeric, 42 comm numeric 43 ); 44 45 create table salgrade ( 46 grade numeric, 47 losal numeric, 48 hisal numeric 49 ); 50 51 insert into salgrade values (1, 700, 1200); 52 insert into salgrade values (2, 1201, 1400); 53 insert into salgrade values (3, 1401, 2000); 54 insert into salgrade values (4, 2001, 3000); 55 insert into salgrade values (5, 3001, 9999);
數據庫練習經典表‘dept’+‘emp’的sql語句