易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL语句PART2

Subquery: (single-row subqueries and multi-rows subqueries).
select select_list
from table
where expr operator (select select_list from table);
single-row subqueries operator: =, >, >=, <, <=, <>
e.g.:
1. select department_id, min(salary) from employees group by department_id having min(salary)>(select mn(salary) from employees where department_id = 50)
* min salary in department_id=50
* list department_id, min(salary) group by department_id and min(salary)> (min salary in departmentid=50).
2. select department_id, min(salary) from employees group by department_id having min(salary)>(select min(salary) from employees group by department_id);
* this sentense is wrong. has the subquery operates multi results.
Multi-row subqueires: any, all, in
IN:     equals to any member in the list
any:   1) must be preceded by =, !=, >, <, <=, >=. 2) compares a value to each value in a list or returned by a query. 3) evaluates to FALSE if the query returns no rows.
all:    1) must be preceded by =, !=, >, <, <=, >=. 2) compares a value to every value in a list or returned by a query. 3) evaluates to TRUE if the query returns no rows.
e.g.:
ndocsortid: 1...9
select ndocsortid from wf_docsort where nmoduleinfoid=2: results: 4,5,9
select ndocsortid from wf_docsort where nmoduleinfoid=9: results: null;
1. select  distinct ndocsortid
from  wf_procname
where ndocsortid < all (select ndocsortid from wf_docsort where nmoduleinfoid=2)
order by ndocsortid
results: 1,2,3
2. select nmoduleinfoid, ndocsortid, nprocid
from  wf_procname
where ndocsortid < any (select ndocsortid from wf_docsort where nmoduleinfoid=2)
order by ndocsortid 
results: 1,2,3,4,5,6,7,8
3. select  distinct ndocsortid
from  wf_procname
where ndocsortid < all (select ndocsortid from wf_docsort where nmoduleinfoid=9)
order by ndocsortid
results: 1,2,3,4,5,6,7,8,9
4. select&


相关文档:

SQL Server死锁总结

1. 死锁原理
    根据操作系统中的定义:死锁是指在一组进程中的各个进程均占有不会释放的资源,但因互相申请被其他进程所站用不会释放的资源而处于的一种永久等待状态。
    死锁的四个必要条件:
互斥条件(Mutual exclusion):资源不能被共享,只能由一个进程使用。
请求与保持条件(Ho ......

如何卸载SQL Server 2005

卸载SQL Server 2005的方法之一,放在这儿只是为了记住:
1:把SQL Server2005的安装盘(安装文件)放入到光驱。
2:打开如下路径:开始/运行,输入:cmd
3:输入下列命令:
 
Start /wait \setup.exe /qb REMOVE=ALL INSTANCENAME=:管区盘符,例如:G:、H:等;:安装的SQLServer实例名称,默认值为:功能 ......

SQL Server 2005 日志删除和日志文件限制(转)


SQL Server 2005 日志删除和日志文件限制(转)
2009年08月04日 星期二 下午 04:40
清除日志:
DECLARE @LogicalFileName sysname,
         @MaxMinutes INT,
         @NewSize INT
USE      szwzcheck ......

关于SQLSERVER中更新Text类型SQL语句解析

 基本方法:
                   
UPDATETEXT { table_name.dest_column_name dest_text_ptr }//{ 要更新的表以及 text、ntext 或 image 列的名称,指向要更新的 text、ntext 或 image 数据的文本指针的值(由 TEXT ......

ORACLE和POSTGRESQL的SQL语句比较

oracle 方法                                                & ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号