select * from txt1

select * from txt2 
select * from txt1 where name in (select name from txt2 where chk = 0) 
select * from txt1 where name not in (select name from txt2 where chk = 0) 
select * from txt1 inner join txt2 on txt1.name = txt2.name 
select * from txt1 left join txt2 on txt1.name = txt2.name 
select * from txt1 right join txt2 on txt1.name = txt2.name 
select * from txt1,txt2 where txt1.name = txt2.name Order By txt2.ID Desc 
select Txt1.name,Sum(Txt1.Sumint) from txt1,txt2 where txt1.name =txt2.name Group by txt1.name 
select count(Txt1.name),sum(sumint) from txt1,txt2 where txt1.name =txt2.name having sum(sumint)<10 
select count(Txt1.name),sum(sumint) from txt1,txt2 where txt1.name =txt2.name having Sum(sumint) >50 
select * from txt1,txt2 where txt1.name <>txt2.name Order by Txt1.Name compute Sum(sumint) by txt1.name 
insert into txt3 select name,Sumint from txt1 
In:等值连接,用来查找多表相同字段的记录 
Not In:非等值连接,用来查找不存在的记录 
Inner join:内连接,主要用来查找都符合条件的记录 
Left join:左连接,主要用来查找左边有,右边没有的用空值表达 
Right join:右连接,主要用来查找右边有,左边没有的用空值表达 
Order By:升序 Asc 降序 Desc 
Group By:分组排序 按字段分组(如按班级分),使用的都要有集合函数存在 
Having :对分组条件进行判断,使用都要确保每个字段都要用集合函数 
COMPUTE BY:子句使您得以用同一 SELECT 语句既查看明细行,又查看汇总行。可以计算子组的汇总值,也可以计算整个结果集的汇总值。 
行聚合函数名称;例如,SUM、AVG、MIN、MAX 或 COUNT 
insert into:主要把查询的语句插入到新表。 
txt1表的数据 
ID Name SumInt 
1 张三 55 
2 李四 85 
3 王五 85 
4 赵六 855 
txt2表的数据 
ID Name Chk 
1 张三 0 
2 李四1 1 
3 王五 0 
4 赵六 0

最新文章

  1. uva131 The Psychic Poker Player
  2. crawler: 爬虫的基本结构
  3. WebDataGrid设置某行某列的值
  4. 【原】兼容IOS6以及旧版本的旋转处理方法,心得总结
  5. Fastreport使用经验(转)在Delphi程序中访问报表对象
  6. Ubontu使用技巧
  7. mysql更改默认存储引擎
  8. C#常用工具类——Excel操作类
  9. (转+原)ipp &quot;No dlls were found in the Waterfall procedure&quot;
  10. java 乱码详解_jsp中pageEncoding、charset=UTF -8&quot;、request.setCharacterEncoding(&quot;UTF-8&quot;)
  11. 【Weblogic】启动命令nohup解析
  12. Union用法及说明:
  13. (转) windows下 安装 rabbitMQ 及操作常用命令
  14. 查看macOS下正在使用的zsh
  15. 树莓派虚拟环境手动安装HA
  16. Linux内核同步机制之(五):Read Write spin lock【转】
  17. mysql索引的选择
  18. c——闰年
  19. MongoDB - 1
  20. Programming for Everyone !

热门文章

  1. 生成package.json和bower.json
  2. querystring,parse和stringify相互转换
  3. springmvc的渲染
  4. 遍历aspx页面中所有的指定控件
  5. C#异常处理表、类、SQL
  6. [技术翻译]Guava官方文档Ordering
  7. 访问快递100的rest的请求
  8. C++ 性能剖析 (三):Heap Object对比 Stack (auto) Object
  9. js获取本月、三个月、今年的日期插件dateHelp
  10. 网易DBA私享会分享会笔记2