ImageVerifierCode 换一换
格式:DOCX , 页数:34 ,大小:21.68KB ,
资源ID:16281145      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/16281145.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(深圳华为SQL总结Word文档下载推荐.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

深圳华为SQL总结Word文档下载推荐.docx

1、匹配1个任意字符%b_sy%-like的查询中转义字符escape的用法-空值检索where price is null -查找价格为null的记录where price is not null -查找价格不为null的记录-限制记录行检索:top 关键字限制结果集中返回的行数select top 3 * from titles -查找前3本图书select top 3 * from titlesorder by price desc -查找价格最贵的3本书distinct 关键字 限制重复行select distinct state from authors -查找所有著书作者的州名-按书店

2、编号和定单号分组统计销量select stor_id,ord_num,sum(qty) from salesgroup by stor_id,ord_numwith cube-按图书类别和出版社统计图书销量select type,pub_id,sum(advance) from titlesgroup by type,pub_id2、多表查询与系统函数select * from authors,titleauthorselect * from titleauthorinner join titleauthoron authors.au_id=titleauthor.au_idinner joi

3、n authorsinner join titleson titleauthor.title_id=titles.title_idleft join titleauthorleft join authorsright outer join authorsjoin titlesfull outer join authorsright join titlesselect au_id ,au_fname from authorsunionselect title_id,price from titlesunion select charindex(abc,cccabcfffabc)select pa

4、tindex(%abc%aaaccabcaaccabcselect dateadd(year,10,2005-2-5select datediff(month,2005-1-12005-2-25select datepart(month,select getdate()select power(2,3)select isdate(205-2-25select isnull(sdddfgdfselect isnull(null,fdsfselect isnumeric(a123select convert(char(10),getdate(),108)3、子查询select stor_id fr

5、om saleswhere qty ( select avg(qty) from sales )select au_id,au_fname from authorswhere au_id in (select au_id from titleauthor group by au_id having count(au_id)=2where au_id not in (select au_id from titleauthor)where not exists select au_id from titleauthor where authors.au_id=titleauthor.au_idse

6、lect * from salesselect * from storesselect title_id,title,pricefrom titleswhere price 2504、数据库管理create database mydataon primary( name=mydata, filename=c:aaamydata.mdf size=5mb, maxsize=50, filegrowth=5log onmydatalogaaamydatalog.ldf filegrowth=5 alter database mydataadd file mydata2aaamydata2.ndfs

7、elect * from sysfilesselect * from sysfiles1select * from sysfilegroupsadd filegroup group1remove filegroup group1modify name= mydata2modify file maxsize=150create database mydata1mydata1aaamydata1.mdf),mydata11aaamydata11.ndffilegroup group1mydata12aaamydata12.ndfmydata13aaamydata13.ndfmydatalog1aa

8、amydatalog1.ldfmydatalog2aaamydatalog2.ldfalter database mydata1modify filegroup group1 defaultdbcc shrinkdatabase(mydata1,80,truncateonly)dbcc shrinkfile(mydata1,3,truncateonly)drop database mydata1sp_helpdb mydata2sp_databasessp_rename mydata3databasesp_dboption select into/bulkcopytrue5、表的管理与数据类型

9、create table students sno int identity(1000,1) primary key, sname varchar(20) not null, age int not null, address varchar(30)select * from studentscreate table #ttselect * from #ttcreate table #tttselect * into #tt1 from studentsselect * into tt1 from studentsselect * from #tt1select au_id,state fro

10、m (select * from authors) salter table studentsadd phone varchar(11)drop column addressalter column age tinyintsp_help studentsdrop table #ttstudentsstusselect * from stussp_help stusdelete stusinsert stus values(zhan san,20,65025215insert students values(johnsondfdsafinsert students(sname,age) valu

11、es(john,20)-insert students(age) values(20)set identity_insert stu1 oninsert students(sno,sname,age,address) values(1006,dfdscfset identity_insert students offinsert students(sname,age,address) values(select * into stu1 from studentsselect * from stu1sp_help stu1delete stu1insert stu1 select * from

12、studentsselect * into authors1 from authorsselect * from authors1alter table authors1drop column au_fnameadd sex char(2) insert authors1(au_id,au_lname,phone,address,city,state,zip,contract,sex) select au_id,au_lname,phone,address,city,state,zip,contract,M from authorsupdate authors1set state=CC,cit

13、y=bkdelete authors1truncate table authors1sp_addtype phonetype,varchar(8)sp_addtype age ,tinyintsp_droptype ageselect * from systypes6、数据完整性 sid varchar(18) not nullsp_help students3create table students1 sno int identity(1000,1) constraint pk_sno primary key,create table students2 sno int identity(

14、1000,1) ,alter table students2add constraint pk_sno2 primary key(sno)create table students3 sid varchar(18) uniquecreate table students4 sid varchar(18) constraint uk_sid unique not nullsp_help students4create table scores1 sno1 int not null constraint fk_sno1 foreign key(sno1) references students4(

15、sno), cno char(5) not null, grade float, constraint pk_smo_cno primary key(sno1,cno)sp_help scores1sp_help titleauthordelete authorswhere au_id=172-32-1176update authorsset au_id=111-11-1111213-46-8915alter table titleauthordrop constraint FK_titleauth_au_id_0519C6AFadd constraint fk11 foreign key(a

16、u_id) references authors(au_id) on delete cascade on update cascadecreate table students5 sex char(2) not null constraint che1 check (sex in (F), sid varchar(18) constraint uk_sid1 unique not nullsp_help students5create table students6 age int not null default 18, sex char(2) not null constraint che

17、11 check (sex in ( sid varchar(18) constraint uk_sid11 unique not nullsp_help students7create table students7 sex char(2) not null constraint che21 check (sex in ( sid varchar(18) constraint uk_sid21 unique not nullalter table students7add constraint def1 default 18 for agedrop constraint def1create

18、 rule rule_ageas age between 0 and 255sp_bindrule rule_age,students7.agesp_unbindrule ,futureonlydrop rule rule_agecreate default def_ageas 18sp_bindefault def_age,sp_unbindefault drop default def_age7、视图与索引if exists(select * from sysobjects where name=v_author and xtype=V drop view v_authorgocreate view v_authorwith encryptionas select au_id,state,city with check optionselect * from v_authorupdate v_authorset city=bj2

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1