SQLserver数据库的一些知识点

SQLServer

由Microsoft牵头开发的关系型数据库。虽然Microsoft公司不受开源者待见,但其开发的软件总还是很有保障的,至少在更新和维护已经用户使用上,真的积累的相当的社会基础和经验。
闲话少叙,书归正传。

SQLServer数据库结构

SQLserver数据库的一些知识点_第1张图片

SQL语法

SQLserver石油default默认模式、数据库的,如果不在SQL指令中指明,就选择默认。

--仅仅列出不同(distinct)的值
select distinct linksrcconfid from sw_dbsync_rule where enable=1;
select * from dbo.person;
--选出记录中所在城市是N打头的人
select * from Persons where city like 'N%';
select * from Persons where city not like 'N%';
--降序排列
select * from Persons where city not like 'N%' order by age desc;
select * from Persons where city not like 'N%' order by age desc, height desc;
--升序排列
select * from Persons where city not like 'N%' order by age asc;
--页大小
select @@maxpagesize

自增字段

create table RECHASHTAB(
    ID BIGINT identity(1,1) PRIMARY KEY NOT NULL, 
    ACTION VARCHAR(8) NOT NULL,
    REALVAL VARCHAR(256), 
    OPTIME BIGINT NOT NULL);

identity(1,1)表示从1开始增加,每条记录加1。

插入数据的时候

insert into RECHASHTAB(ACTION,HASHVAL,REALVAL,OPTIME) 
    values(...);

程序员接口

作为Microsoft公司的数据库,当然是有ODBC的接口。
另外还有一个FreeTDS的接口,我现在用的就是FreeTDS接口。不要问我为什么!我也不知道我拿到前代的代码就是这个接口!~_~

你可能感兴趣的:(数据库拾遗)