预览加载中,请您耐心等待几秒...
1/8
2/8
3/8
4/8
5/8
6/8
7/8
8/8

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

--T-SQL字符串函数 selectname,LEFT(name,12)asbiketype, SUBSTRING(name,9,4)asmodel, RIGHT(name,2)assize, RTRIM(style)asstyle fromProduction.Product whereProductNumberlike'bk-t%'; selectREPLACE(name,'mountain','Mtn')asReplaceName, STUFF(name,11,2,'x01')asStuffName, REVERSE(productnumber)asReverseNum, STUFF(productnumber,1,2,REPLICATE(0,3))asReplicateNum, productnumber+SPACE(4)+LOWER(productline)asProductLine fromProduction.Product whereProductID='771'; selectname+CHAR(9)+str(makeflag)asProduct, ASCII(makeflag)asasciiMakeFlag, RTRIM(style)asstyle, UNICODE(rtrim(style))asunicodeStyle fromProduction.Product whereProductID='771'; selectLEN(Description)asLenghthDescription, CHARINDEX('tech',description)asCharIndexDescription, PATINDEX('%bike%',description)asPatindexDescription fromProduction.ProductDescription whereProductDescriptionID='321'; select*fromProduction.ProductDescriptionwhereProductDescriptionID='321'; declare@Name1varchar(30) set@Name1=( selectlastname fromPerson.Contact whereContactID='1829') declare@Name2varchar(30) set@Name2=( selectlastname fromPerson.Contact whereContactID='2580') select@Name1asName1,@Name2asName2, Soundex(@Name1)assoundexname1, soundex(@Name2)assoundexname2, difference(@Name1,@Name2)assoundexdiff --T-SQL数学函数 selectTerritoryID, AVG(SubTotal)asavgsales, SUM(subtotal)assumsales, MAX(subtotal)asmaxsales, MIN(subtotal)asminsales fromSales.SalesOrderHeader groupbyTerritoryID orderbyTerritoryID selectmin(name)asfirstproduct, MAX(name)aslastproduct fromProduction.Product selectCOUNT(*)asproductcount, COUNT(productmodelid)asmodelcount, COUNT(distinctProductModelID)asdistinctcount fromProduction.Product selectColor, AVG(listprice)asavgprice, COUNT(*)astotalAmount, GROUPING(color)asaggGroup fromProduction.Product groupbyColor withrollup selectCHECKSUM_agg(CAST(Quantityasint))aschecksum_agg, CHECKSUM_agg(distinctCAST(quantityasint))aschecksumdistinct fromProduction.ProductInventory select*fromProduction.ProductInventory decla