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

SQL语句PART8

PairWise subquery:
e.g.:
select * from wf_docsort where (ndocsortid,nmoduleinfoid)  in (select ndocsortid, nmoduleinfoid from wf_docsort where instr(cname,'文')>0)
the above sql is the same function as:
select * from wf_docsort where ndocsortid = (select ndocsortid from wf_docsort where instr(cname,'xx')>0) and nmoduleinfoid = (select nmoduleinfoid from wf_docsort where instr(cname,'xx')>0)
A scalar subquery expression is a subquery that: returns exactly one column value from one row. Scalar subqueries can be used in: 1) The condition and expression part of DECODE and CASE 2) All clauses of SELECT except GROUP BY 3) The SET clause and WHERE clause of an UPDATE statement
e.g.:
select * from wf_docsort
results:
1    1    收文            SHOUWEN
2    1    发文            FAWEN
3    1    交办            JIAOBAN
4    2    值班报告     REPORT
5    3    督察督办     SUPERVISAL
6    2    值班快报     DAILYREPORT
7    2    我的事情     NOTIFY
8    4    提案            RESOLUTION
9    4    建议            SUGGESTION
select NDOCSORTID, NMODULEINFOID,CNAME,KEY,(
       case when nmoduleinfoid=(
               select nmoduleinfoid from wf_moduleinfo where nmoduleinfoid=1
        ) then 'JEAN1' else (case when nmoduleinfoid=(select nmoduleinfoid from wf_moduleinfo
 &n


相关文档:

[转]SQL行列互换

问题:假设有张学生成绩表(tb)如下:
姓名 课程 分数
张三 语文 74
张三 数学 83
张三 物理 93
李四 语文 74
李四 数学 84
李四 物理 94
想变成(得到如下结果): 
姓名 语文 数学 物理 
---- ---- --- ......

SQL SERVER 2005 .NET UDF

using System;
using System.Text.RegularExpressions;
using Microsoft.SqlServer.Server;
public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction(IsDeterministic = true,IsPrecise = true)]
public static bool RegExIsMatch(string pattern,string matchString)
{ ......

ORACLE PL/SQL包(package)学习笔记

包由包规范和包体两部分组成。
 
1、包规范(Package Specification)
包规范,也叫做包头,包含了有关包的内容的信息。但是,它不包含任何过程的代码。
创建包头的语法一般如下
 
CREATE [OR REPLACE] PACKAGE package_name {IS | AS}
Procedure_name | function_name | variable_declaration | type_def ......

SQL语句PART3

constraint Example:
1. grammer:
 create table [schema.]table
      (column datatype [DEFAULT expr]
     [column_constraint], ...
     [table_constraint] [,......]);
2. example of a column_level constraint:
create table empl ......

SQL语句PART6

Differring Constraints:
Constraints can have the following attributes: DEFFERRABLE / NOT DEFFERRABLE,  INITIALLY DEFFERRED / INITIALLY IMMEDIATE.
e.g.:
alter table dept2 add constraint dept2_id_pk primary key (department_id) deferrable initially deferred; // deferring constraint on creation. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号