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

Sql语句中IN等方面的用法的更多相关文章

  1. SQL语句中exists/not exists的用法分析

    作者:Dsw 比如在Northwind数据库中有一个查询为 SELECT c.CustomerId,CompanyName FROM Customers c WHERE EXISTS( SELECT ...

  2. sql语句中----删除表数据drop、truncate和delete的用法

    sql语句中----删除表数据drop.truncate和delete的用法 --drop drop table  tb   --tb表示数据表的名字,下同 删除内容和定义,释放空间.简单来说就是把整 ...

  3. SQL语句中count(1)count(*)count(字段)用法的区别

    SQL语句中count(1)count(*)count(字段)用法的区别 在SQL语句中count函数是最常用的函数之一,count函数是用来统计表中记录数的一个函数, 一. count(1)和cou ...

  4. sql语句中charindex的用法 可用于截取字符串

    使用CHARINDEX和PATINDEX函数来搜索文字列和字符串.这两个函数是如何运转的,解释他们的区别.同时提供一些例子,通过这些例子,你可以可以考虑使用这两个函数来解决很多不同的字符搜索的问题. ...

  5. (转载)总结一下SQL语句中引号(')、quotedstr()、('')、format()在SQL语句中的用法

    总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的用法 总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中 ...

  6. 总结一下SQL语句中引号(')、quotedstr()、('')、format()在SQL语句中的用法

    总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的用法 日期:2005年6月1日 作者:seasky212 总结一下SQL语句中引号(').quoted ...

  7. (转载)总结一下SQL语句中引号(')、quotedstr()、('')、format()在SQL语句中的用法

    总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的用法以及SQL语句中日期格式的表示(#).('')在Delphi中进行字符变量连接相加时单引号用('' ...

  8. SQL语句中 INNER JOIN的用法!

    一.SQL语句中  INNER JOIN的用法? 1.INNER JOIN的作用? 可以在两个或者更多的表中获取结果,得出一张新表. [隐式内连接] 表一 car  购物车 表二 user 用户 发现 ...

  9. SQL语句中的select高级用法

    #转载请联系 为了更好的了解下面的知识点,我们先创建两张表并插入数据. # 学生表 +----+-----------+------+--------+--------+--------+------ ...

随机推荐

  1. [AWS] Install the AWS cli

    On Windows, just download the installer and install it. Configure: aws configure In your aws console ...

  2. Android 开源项目android-open-project解析之(三) ScrollView,TimeView,TipView,FlipView

    九.ScrollView Discrollview 支持滚动时Item淡入淡出,平移,缩放效果的ScrollView 项目地址:https://github.com/flavienlaurent/di ...

  3. 数据挖掘方面重要会议的最佳paper集合

    数据挖掘方面重要会议的最佳paper集合,兴许将陆续分析一下内容: 主要有KDD.SIGMOD.VLDB.ICML.SIGIR KDD (Data Mining) 2013 Simple and De ...

  4. CALayer的基本操作

     CALayer简介:   CALayer又称为层. 在每一个UIView内部都有一个Layer这样的属性. UIView之所以能够显示,就是因为它里面有这个一个层,才具有显示的功能. 我们通过操作C ...

  5. 学习《Spring 3.x 企业应用开发实战》Day-1

    Day-1 记录自己学习spring的笔记 提要:根据<Spring 3.x 企业应用开发实战>开头一个用户登录的例子,按照上面敲的. 1.项目分层

  6. 在一个UIView中如何使用多个UIPickerView

    可以现在storyboard的UIView中拖入多个UIPickerView 然后同样是继承相关的UIPickerView协议 <UIPickerViewDataSource,UIPickerV ...

  7. Verilog之event的用法

    编写verilog的testbench时,可使用event变量触发事件. event变量声明为: event var; event触发为: ->var; 捕获触发为: @(var); 在mode ...

  8. codevs 1378 选课 (树形DP)

    #include<iostream> #include<cstdio> #include<cstring> using namespace std; ][],f[] ...

  9. C#解leetcode 228. Summary Ranges Easy

    Given a sorted integer array without duplicates, return the summary of its ranges. For example, give ...

  10. 刚入门的easyui

    这两天看了下easyui的教学先说说自己的一些小小理解吧! ----在使用easyui中也遇到了一个问题 : Uncaught TypeError:cannot call method ‘offset ...