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

SQL 行数的选择

Oracle数据库
SELECT
    *
from
(
    SELECT
        ROWNUM AS NO_ROW
        ,row_.*
    from
    (
        SELECT
            *
        from
            PLAN_TEMP
    ) row_
)
WHERE
    NO_ROW BETWEEN 1 AND 12
PostgreSQL
select * from table limit 1 offset 12;
MySQL
select * from table limit 1, 12
SQL Server
select top 12 * from table
分页:
1.Oracle
SELECT
    *
from (
    SELECT
        row_.*, rownum rownum_
    from
        (...... ) row_
    WHERE
        rownum <= ?)
WHERE rownum_ > ?
先按查询条件查询出从0 到页未的记录.然后再取出从页开始到页未的记录.(据说是效率最高的:))  
2. SQL Server
i:select top [pagesize] *
from table
where
    id not in (
        select top [pagesize*(currentpage-1)] id
        from table
        [查询条件] order by   id )
    and [查询条件] order by id
先按查询条件排除 pagesize*[pagesize* (currentpage-1)]以前的纪录。&&再按查询条件把他以后的记录 top[pagesize] 出 来.
ii: select top PageSize *
from TableName
where id > (
    select max(id)  
    from
        (select top startRecord-1 id
        from TableName
        [查询条件]
      


相关文档:

航空公司管理系统(VC++ 与SQL 2005)

系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
      这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......

oracle中比较实用sql语句

-- 查看ORACLE 数据库中本用户下的所有表
SELECT table_name from user_tables;
-- 查看ORACLE 数据库中所有用户下的所有表
select user,table_name from all_tables;
-- 查看ORACLE 数据库中本用户下的所有列
select table_name,column_name from user_tab_columns;
-- 查看ORACLE 数据库中本用户下的所有列
se ......

Oracle SQL实例

1。select * from a where a.rowid=(select min(b.rowid) from b where a.id=b.id);
create test1(
nflowid number primary key, 
ndocid number,
drecvdate date);
insert into test1 values (1, 12301, sysdate) ;
insert into test1 values (2, 12301, sysdate);
select * from test1 order by drecvdate:
......

SQL Server 2005 中使用正则表达式匹配

CLR 用户定义函数只是在 .NET 程序集中定义的静态方法。CREATE FUNCTION 语句已扩展为支持创建 CLR
用户定义函数。
1、创建数据库项目
  
2、添加用户定义函数
  
以下是演示代码:
Code
using
 System;
using
 System.Data;
using
 System.Data.SqlClient;
using
 System.Data.Sql ......

SQL Server 2005导入和导出

在 SQL Server Management Studio 中,连接到数据库引擎服务器类型,展开数据库,右键单击一个数据库,指向“任务”,再单击“导入数据”或“导出数据”。
或者
开始并选择运行并输入CMD 然后在命令提示符里输入DTSWIZARD。

在命令提示符窗口中运行 DTSWizard.exe(位于 C:\Program ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号