SQL分页查询
/*第几页必须大于1
select top 每页数量 * id
from @t a
where id not in
(select top (第几页-1)*每页数量 id
from @t b
)
*/
declare @lcSqlCommand nvarchar(100)
declare @t table (id int IDENTITY,orderDate datetime)
insert into @t
select orderDate
from Northwind..Orders
--返回第二页数据
select top 10 *
from @t a
where id not in
(select top 10 id
from @t b
)
相关文档:
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 ......
SQL Server 2005 数据类型
创建数据库表时,必须为表中的每列分配一种数据类型。
1. 字符串类型
字符串类型包括varchar,char,nvarchar,nchar,text和ntext.这些数据类型用于存储字符数据。Varchar和char类型之间的差别是数据填充。如果要节省空间,为什么有时候还使用char数据类型呢 ......
/// <summary>
/// 返回分页SQL语句
/// </summary>
/// <param name="selectSql">查询SQL语句</param>
/// ......
Use equality first.
使用等连接
Use range operators only where equality does not apply.
只有在等连接不可用的情况下事由区间连接
Avoid use of negatives in the form of !=
or NOT.
避免使用 != 或者 not
Avoid LIKE pattern matching.
避免使用 LIKE匹配
Try to retrieve specific rows and in small n ......