.............................Windows Phone 7手机开发
如果是一个没有客户端就只能通过Sql 用户登录;
若没有安装客户端
在Sql 外围应用配置器——》服务和链接的外围服务器——》远程连接 ,选择tcp/ip协议 。sql server Brower 启动
数据库的访问量受到限制
设计数据库必须满足范式
范例数据库
在数据库定义nchar(20)时必须trim()
在数据库float类型对应应用程序的double类型
Getdate() 的获取当前日期
一般查询
Select * from employee where datadiff(year,hir_date,getdate)>20//两个日期差
Select Datepart(mm,”1899-9-5”) as month//查询日期中的月份
Select datepart(dy,’2122-7-5’)
Select len(fname) from employee where emp_id=’pha222’//求的参数的实际长度
如何把正数转化成字符串
Declare @i int //一个@是局部变量@@是全局变量
Select @i= job_lvl from employee where emp_id=’aaa’
Print convert( char(10), @i)+’job’//convert 是类型转换的
数据库中in的用法,not in 是不包括
Select distinct (city) from author //消除重腹行
Select distinct (city) from authors order by city asc //默认是升序desc降序
Select count(*) as ‘记录个数’ from author 查询多少条记录
As 是关键字
记录的前三条记录
Select top 3 * from authors
数据在磁盘上是按顺序排序(按升序排好序)
Unqiue 对表的唯一性
Select top 0 * from authors –查询列名//
Select * from authors where city<>’san jose’
--分组查询
--统计某个城市作者的人数//按城市分组
Select count(*) as ‘人数’,city from authors group by city
//查询属于同一个出版社的图书记录格式
Select count(*) as ‘记录个数’,pub_id from titles where pub_id
=’123’ group by pub_id
聚合函数count,sum,max,min,avg
--查询属于同一个出版社出版的单价最大的图书单价
Select max(price),pub_id from title group by pub_id
子查询的例子
Select pub_id from publisher where pub_name
嵌套查询
Select au_id ,au_fname,city from authors where city=
(select city from authors where au_fname=’namjiorie’)
查询预付款大于business 图书预付款的图书信息
Select advance ,title,from titles where advance >
(Select max(advance) form titles where type=’business’)
.............................Windows Phone 7手机开发