—-
EMP DEPT SALGRADE bonus
N N-1
scott—-loc
SCOTT—GRADE
t1 省份 城市 景区
t2 省份 城市 小吃
select jq,xc from t1,t2 where t1.sf=t2.sf and t1.cs=t2.cs
cross join
natural join
inner join –using on
(left right full )outer join
–where
set 操作 集合操作
1—列的数量要一样,如果不一样,用null填充
2—列的名字以第一个集合为准
3—列的数据类型要一样,如果不一样,用 to_char to_number to_date去转换
和scott在同一部门,并且工资比他低的都是谁?
SQL> select em1.ename from emp em1 where sal<(select sal from emp out1 where em1.deptno=out1.deptno and ename=’SCOTT’);
SQL> select ename from emp where deptno=(select deptno from emp where ename=’SCOTT’) and sal<(select sal from emp where ename=’SCOTT’);
SQL> select ename from emp,(select deptno ,sal from emp where ename=’SCOTT’) e2 where emp.deptno=e2.deptno and emp.sal<e2.sal;
和scott在同一部门,并且职位也一样的都是谁?
伪劣 伪列
desc emp
select ss from emp;
rownum