内连接
select e.empno as 员工编号,
e.ename as 员工名字,
d.dname as 部门名字
from emp e inner join dept d
on e.deptno=d.deptno
where e.deptno=10;
左连接
select e.empno as 员工编号,
e.ename as 员工名字,
d.dname as 部门名字
from emp e left join dept d
on e.deptno=d.deptno
where e.deptno=10;
右连接
select e.empno as 员工编号,
e.ename as 员工名字,
d.dname as 部门名字
from emp e right join dept d
on e.deptno=d.deptno
where e.deptno=10;
分组连接
select e.deptno
from emp e
Group by e.deptno
having avg(e.sal)>=2000
升序,降序
ASC和desc
增删改
insert into emp e(e.comm,e.deptno,e.empno,e.ename,e.hiredate,e.job,e.mgr,e.sal)values('1','1','1','1','1','1','1','1');
delete from emp where empno=7369;update userinfo u set u.username='sss';
update userinfo u set u.username='sss';
select count(*) as 总人数,max(e.sal) as 最高工资,min(e.sal) as 最低工资,avg(e.sal) as 平均工资 ,sum(e.sal) as 总工资 from emp e;
select createUid from dual;//随机32位字符id