随笔分类 - sql
sql 约束语句
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->--------添加主键约束(bookid作为主键) alter table bookmessage add constraint pk_bookid primary key(bookid) ---...
阅读全文
SQL日期和时间函数总结
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 函数 参数/功能 GetDate( ) 返回系统目前的日期与时间 DateDiff (interval,date1,date2) 以interval 指定的方式,返回date2 与date1两个...
阅读全文
sql语句复习
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->一、基础1、说明:创建数据库CREATE DATABASE database-name 2、说明:删除数据库drop database dbname3、说明:备份sql server--- 创建 备份数据...
阅读全文
分页存储过程(增加了选择字段列表、排序方式参数)
摘要:CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->*数据库分页存储过程,支持倒序和升序参数说明: @tablename:为搜索表名 @tablefield:为表的字段,约定为表的主键, @where:为搜索表名,要显示所有记录请设为"1=1...
阅读全文
【转】海量数据库的查询优化及分页算法方案
摘要:很多人不知道SQL语句在SQL SERVER中是如何执行的,他们担心自己所写的SQL语句会被SQL SERVER误解。比如:select * from table1 where name='zhangsan' and tID > 10000 和执行:select * from table1 where tID > 10000 and name='zhangsan' 一些人不知道以上两条语句的执行...
阅读全文
【转】SQLServer和Oracle常用函数对比
摘要:数学函数 1.绝对值 S:select abs(-1) value O:select abs(-1) value from dual 2.取整(大) S:select ceiling(-1.001) value O:select ceil(-1.001) value from dual 3.取整(小) S:select floor(-1.001)...
阅读全文
*SQL JOIN 的用法
摘要:关于sql语句中的连接(join)关键字,是较为常用而又不太容易理解的关键字,下面这个例子给出了一个简单的解释 --建表table1,table2: create table table1(id int,name varchar(10)) create table table2(id int,score int) insert into table1 select 1,'lee' insert i...
阅读全文
浙公网安备 33010602011771号