# orcle学习之路第二天

1.Order by:
select * from zybrxx order by zyh asc
Select * from zybrxx order by zyh desc
select zyh, brxm,bqh from zybrxx order by bqh,zyh
select zyh, brxm,bqh from zybrxx order by zyh,bqh
select zyh, brxm,bqh from zybrxx order by bqh asc,zyh desc
select * from zybq order by dm desc ,lc asc
2.Group by:select count(*) from zybrxx group by bqh
SQL 无法把正常的列和汇总函数结合在一起
select count(*),zyh from zybrxx group by bqh//会提示错误

3.Having:select sum(zfze) from zybrxx group by zfze having sum(zfze)>0

4.在一个sql中使用多个表：交叉联合select * from ksmc,zybq
select no,xh,dm from ksmc,zybq
5.等值联合：select * from zybrxx a,ksmc b where b.no = a.ksbh and a.ksbh<2
6.不等值联合：select * from zybrxx a,ksmc b where b.no > a.ksbh
7.select * from zybrxx a join ksmc b on a.ksbh=b.no那个表在前就以那个表为主
8.右联接：select * from ksmc b right outer join zybrxx a on a.ksbh =b.no
9.左联接：select * from ksmc b left outer join zybrxx a on a.ksbh =b.no

10.select * from zybrxx a,ksmc b where a.ksbh=(select no from ksmc where mc=’内科’ ) and a.ksbh =b.no
11.子查询的嵌套：select * from zybrxx a,ksmc b where a.ksbh=(select no from ksmc where mc=(select mc from ksmc where no=1 )) and a.ksbh =b.no

12.插入语句Insert values：insert into zybq(dm,mc,qx,dnfykf,bqfl,lc,srm1,srm2,cwyybz) values(‘12’,’病区2’,’**’,’02’,0,666,’88BQ’,’88UA’,’Y’)

Insert select:insert into new_table select * from zybq//可完成对表的备份
13.Update:update zybq set mc=’病区2眼科’ where dm=’15’

14.Delete:delete from zybq where dm=’15’

#### 关于入职第二天

2017-09-27 18:02:32

#### 第二天 工作总结

2017-11-02 15:07:34

#### orcle学习之路第一天

2016-08-31 11:09:10

#### Qt学习之路系列教程目录

2016-11-23 21:46:24

#### orcle学习之路第三天

2016-08-31 11:07:32

#### 《Qt学习之路2》2014年6月最新完整版带目录

2014年06月07日 3.97MB 下载

#### QT学习之路2 （1~82篇）

2014年11月02日 5.67MB 下载

#### 学习之路的一些感悟

2011-11-20 23:15:50

#### Qt学习之路源码

2016年01月20日 7.1MB 下载

#### oracle菜鸟到大神之路

2014-03-11 17:34:03