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

SQL分页查询

thunder:
1.MYSQL实现
mysql> select * from user;
+----+----------+----------+-----------------+
| ID | username | password | email           |
+----+----------+----------+-----------------+
|  1 | admin    | admin    | abc@yahoo.cn    |
|  2 | thomas   | 159753   | thomas@yahoo.cn |
|  3 | thomas1  | 159753   | thomas@yahoo.cn |
|  4 | huhu     | 159753   | hu@yahoo.cn     |
|  5 | fdg      | dfg      | fdg             |
|  6 | sdf      | sd       | sdf@yahoo.cn    |
|  7 | d        | d        | d@d.cn          |
+----+----------+----------+-----------------+
7 rows in set (0.00 sec)
mysql> select * from user limit 3,2;
+----+----------+----------+-------------+
| ID | username | password | email       |
+----+----------+----------+-------------+
|  4 | huhu     | 159753   | hu@yahoo.cn |
|  5 | fdg      | dfg      | fdg         |
+----+----------+----------+-------------+
2 rows in set (0.00 sec)
mysql>
===================================================
2.MSSQLServer实现
select top 5 function_id,function_name from d_function
where function_id not in (select top 5 function_id from d_function)
6 月统计
7 部门查询
8 公司查询
9 工程招标
10 工程总结


相关文档:

[收拢] 用sqlite 执行标准 sql 语法

http://www.umgr.com/blog/PostView.aspx?bpId=36294
 1. 执行sql语句
int sqlite3_exec(sqlite3*, const char *sql, sqlite3_callbacksql 语法
, void *,  char **errmsg );
这就是执行一条 sql 语句的函数。
第1个参数不再说了,是前面open函数得到的指针。说了是关键数据结构。
第2个参数const char ......

SQLSERVER 分页存储过程(2 在SQL2005下使用)

之前有一个SQLServer的分页存储过程 但是性能不是十分理想
又找了一个 
--SQL2005分页存储过程
/**
if  exists(select * from sysobjects where name='fenye')
drop proc fenye
**/
CREATE procedure fenye
  @tableName nvarchar(200) ,
  @pageSize int,
  @curPage int ,
  ......

sql语句优化2

(18)用EXISTS替换DISTINCT:
当提交一个包含一对多表信息(比如部门表和雇员表)的查询时,避免在SELECT子句中使用DISTINCT。一般可以考虑用EXIST替换, EXISTS 使查询更为迅速,因为RDBMS核心模块将在子查询的条件一旦满足后,立刻返回结果。例子:
(低效):
SELECT DISTINCT DEPT_NO,DEPT_NAME  ......

读《SQL Server 2005高级管理》的一些摘要... 连载5

在T-SQL中监视进程
DBA更愿意使用T-SQL的原因是可以比“活动监视器”更加灵活地获得信息。
1.       sp_who和sp_who2
存储过程sp_who也返回当前连接数据库实例,与“活动监视器”非常类似。然而,用户可能发现自己更愿意使用未公开说明的sp_who2存储过程,因为它提供 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号