新疆哪里有卖树莓种子的?

小说:新疆哪里有卖树莓种子的?作者:密伯更新时间:2019-04-20字数:12123

创建三个空表emp1,emp2,emp3,结构参考emp表

CREATE TABLE EMP1 AS SELECT * FROM EMP WHERE 1=2;

CREATE TABLE EMP2 AS SELECT * FROM EMP WHERE 1=2;

CREATE TABLE EMP3 AS SELECT * FROM EMP WHERE 1=2;

用一条INSERT语句将emp表中部门号为10的插入到emp1,20的插入到emp2,30的插入到emp3

INSERT ALL

WHEN DEPTNO=10 THEN

INTO EMP1

WHEN DEPTNO=20 THEN

INTO EMP2

WHEN DEPTNO=30 THEN

INTO EMP3

SELECT * FROM EMP;

创建一个表t35,x列为任意时间戳类型,插入当前时间,并查询

CREATE TABLE T35(X TIMESTAMP WITH LOCAL TIME ZONE);

INSERT INTO T35 VALUES(SYSDATE);

SELECT * FROM T35;

查询emp表所有员工信息,谁的薪金超过其部门的平均工资

SELECT ENAME,SAL,DEPTNO FROM EMP OUTER_TABLE

WHERE SAL>(SELECT AVG(SAL) FROM EMP INNER_TABLE WHERE INNER_TABLE.DEPTNO=OUTER_TABLE.DEPTNO);

查询emp中不是领导的几层员工信息

SELECT * FROM EMP OUTER_TABLE WHERE NOT EXISTS (SELECT "X" FROM EMP INNER_TABLE WHERE INNER_TABLE.MGR = OUTER_TABLE.EMPNO);

查找dept表中没有任何员工的部门

SELECT DEPTNO,DNAME FROM DEPT WHERE NOT EXISTS(SELECT "X" FROM EMP WHERE EMP.DEPTNO=DEPT.DEPTNO);

在hr用户授权scott可以查询employees,departments表的权限

GRANT SELECT ON DEPARTMENTS TO SCOTT;

GRANT SELECT ON EMPLOYEES TO SCOTT;

在scott用户创建同名employees,departments表并复制数据

CREATE TABLE EMPLOYEES AS SELECT * FROM HR.EMPLOYEES;

CREATE TABLE DEPARTMENTS AS SELECT * FROM HR.DEPARTMENTS;

在scott用户给employees表增加一列,部门名称

ALTER TABLE EMPLOYEES ADD(DNAME VARCHAR2(20));

在scott用户根据departments表的部门名称更新employees表的部门名称

UPDATE EMPLOYEES SET DNAME=(SELECT DEPARTMENT_NAME FROM DEPARTMENTS WHERE DEPARTMENTS.DEPARTMENT_ID=EMPLOYEES.DEPARTMENT_ID);

SELECT * FROM DEPARTMENTS;

SELECT * FROM EMPLOYEES;

在scott用户employees中删除在location_id是1700地区的员工信息

DELETE FROM EMPLOYEES WHERE DEPARTMENT_ID IN(SELECT DEPARTMENT_ID FROM DEPARTMENTS WHERE LOCATION_ID=1700);

当前文章:http://scycxh.com/content/2019-04/14/content_70814.html

发布时间:2019-04-20 03:45:09

玫瑰一平方种几株? 江西哪里有卖小叶女贞小苗? 200万棵北美海棠苗,全国第三海棠苗基地大量出货 新疆哪里有卖红枫小苗的 ? 紫藤多季品种有哪些? 丰花月季2年生什么价格? 皇竹草是什么牧草品种,有什么作用? 三色旋花种子几月播种最好? 百慕大草种子怎么种呢? 哪里卖法桐种子?

23280 56109 47498 89357 55869 83781 59655 73604 28797 62616 91404 14007 47670 87696 34581 84341 67961 68062 39718 41853 15808 88369 96785

我要说两句: (0人参与)

发布