资源描述:
《oracle数据库学习笔记》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、注意:学习的朋友要先在数据库中创建这2个表,后边是示例都按照这2个表演示的;--样例表1:部门表CREATETABLEdept(deptnoNUMBER(2)PRIMARYKEY,dnameVARCHAR2(14),locVARCHAR2(13));--部门表中的数据INSERTINTOdeptVALUES(10,'ACCOUNTING','beijing');INSERTINTOdeptVALUES(20,'RESEARCH','tianjin');INSERTINTOdeptVALUES(30,'SALES','shanghai');INSERTINTOdeptVALUES(40,'
2、OPERATIONS','guangzhou');--样例表2:职员表empCREATETABLEemp(empnoNUMBER(4)PRIMARYKEY,enameVARCHAR2(10),jobVARCHAR2(9),mgrNUMBER(4),hiredateDATE,salNUMBER(7,2),commNUMBER(7,2),deptnoNUMBER(2)CONSTRAINTFK_DEPTNOREFERENCESDEPT);--给数据表emp增加记录INSERTINTOempVALUES(7369,'SMITH','CLERK',7902,to_date('17-12-1980'
3、,'dd-mm-yyyy'),800,NULL,20);INSERTINTOempVALUES(7499,'ALLEN','SALESMAN',7698,to_date('20-02-1981','dd-mm-yyyy'),1600,300,30);INSERTINTOempVALUES(7521,'WARD','SALESMAN',7698,to_date('22-02-1981','dd-mm-yyyy'),1250,500,30);INSERTINTOempVALUES(7566,'JONES','MANAGER',7839,to_date('02-04-1981','dd-mm-
4、yyyy'),2975,NULL,20);INSERTINTOempVALUES(7654,'MARTIN','SALESMAN',7698,to_date('28-09-1981','dd-mm-yyyy'),1250,1400,30);INSERTINTOempVALUES(7698,'BLAKE','MANAGER',7839,to_date('01-05-1981','dd-mm-yyyy'),2850,NULL,30);INSERTINTOempVALUES(7782,'CLARK','MANAGER',7839,to_date('09-06-1981','dd-mm-yyyy
5、'),2450,NULL,10);INSERTINTOempVALUES(7788,'SCOTT','ANALYST',7566,to_date('09-12-1982','dd-mm-yyyy'),3000,NULL,20);INSERTINTOempVALUES(7839,'KING','PRESIDENT',UNLL,to_date('17-11-1980','dd-mm-yyyy'),5000,NULL,10);INSERTINTOempVALUES(7844,'TURNER','SALESMAN',7698,to_date('08-09-1981','dd-mm-yyyy'),
6、1500,0,30);INSERTINTOempVALUES(7876,'ADAMS','CLERK',7788,to_date('12-01-1983','dd-mm-yyyy'),1100,NULL,20);INSERTINTOempVALUES(7900,'JAMES','CLERK',7698,to_date('03-12-1981','dd-mm-yyyy'),950,NULL,30);INSERTINTOempVALUES(7902,'FORD','ANALYST',7566,to_date('03-12-1981','dd-mm-yyyy'),3000,NULL,20);I
7、NSERTINTOempVALUES(7934,'MILLER','CLERK',7782,to_date('23-01-1982','dd-mm-yyyy'),1300,NULL,10);insertintoemp(empno,ename,job,hiredate,sal,deptno)values(7839,'KING','PRESIDENT',to_date('17-11-1981','dd-mm-yy'),5000,10);