资源预览内容
第1页 / 共21页
第2页 / 共21页
第3页 / 共21页
第4页 / 共21页
第5页 / 共21页
第6页 / 共21页
第7页 / 共21页
第8页 / 共21页
第9页 / 共21页
第10页 / 共21页
亲,该文档总共21页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
深圳华为SQL总结 1-更改列标题的三种方法select au_id作者编号,作者姓名=au_lname,phone as电话from authors-where条件查询select*from authors where state=ca-查询住在加州的作者-between.and.条件查询select*from titles where pricebetween10and20-查找图书价格在10至20元间的图书-逻辑运算符、关系运算符的应用select*from titles where price=10and price(select avg(qty)from sales)select au_id,au_fname from authors where au_id in(select au_id from titleauthor group by au_id havingcount(au_id)=2)select au_id,au_fname from authors where au_id notin(select au_id from titleauthor)select au_id,au_fname from authors wherenot exists(select au_id from titleauthor where authors.au_id=titleauthor.au_id)select*from salesselect*from storesselect title_id,title,price from titleswhere price250)4create databasemydata on primary(name=mydata,filename=c:aaamydata.mdf,size=5mb,maxsize=50,filegrowth=5)log on(name=mydatalog,filename=c:aaamydatalog.ldf,size=5mb,filegrowth=5)alter databasemydata addfile(name=mydata2,filename=c:aaamydata2.ndf,size=5mb,maxsize=50,filegrowth=5)select*from sysfilesselect*from sysfiles1select*from sysfilegroupsalter databasemydata addfilegroup group1alter databasemydata removefilegroup group1alter databasemydata modifyname=mydata2alter databasemydata modifyfile(name=mydata,maxsize=150)create databasemydata1onprimary(name=mydata1,filename=c:aaamydata1.mdf,size=5mb,maxsize=50,filegrowth=5),(name=mydata11,filename=c:aaamydata11.ndf,size=5mb,maxsize=50,filegrowth=5),filegroup group1(name=mydata12,filename=c:aaamydata12.ndf,size=5mb,maxsize=50,filegrowth=5),(name=mydata13,filename=c:aaamydata13.ndf,size=5mb,maxsize=50,filegrowth=5)log on(name=mydatalog1,filename=c:aaamydatalog1.ldf,size=5mb,filegrowth=5),(name=mydatalog2,filename=c:aaamydatalog2.ldf,size=5mb,filegrowth=5)alter databasemydata1modify filegroupgroup1default dbshrinkdatabase(mydata1,80,truncateonly)db shrinkfile(mydata1,3,truncateonly)drop databasemydata1sp_helpdb mydata2sp_databases sp_renamemydata2,mydata3,databasesp_dboptionmydata3,select into/bulkcopy,true5create table students(sno intidentity(1000,1)primary key,sname varchar (20)not null,age int not null,address varchar (30)select*from studentscreate table#tt(sno intidentity(1000,1)primary key,sname varchar (20)not null,age intnot null,address varchar (30)select*from#tt create table#ttt(sno intidentity(1000,1)primary key,sname varchar (20)not null,age intnot null,address varchar (30)select*into#tt1from studentsselect*into tt1from studentsselect*from#tt1select au_id,state from(select*from authors)sselect*from#tt alter tablestudentsadd phonevarchar (11)alter tablestu
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号