资源描述:
《chapter查寻数据(Chapter search data)》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、chapter2查寻数据(Chapter2searchdata)SinglelinenotesMultilinecomment/**/Thefirststep:createdatabaseniitdb/*Databasefilecontains:Masterdatafile:niitdb.mdfLogfile:niitdb_log.ldfThesecondstepistoseparatedatabase,adddatabase,backupandrestoredatabaseEstablishingD:Da
2、tsbaseThirdsteps:CreatestudenttableStuNoStuNameagesexaddressCommondatatypes:Values:int1,2,3............Shortnumericaltype:smallIntLongnumericaltype:bigIntDecimalpoint(floatingpoint,singleprecision):float-->3.14Doubleprecision:double-->3.1415926533348Charact
3、ertype:char-->'a','b','1'String:string-->"abkei""Sql:structuredquerylanguage(structquerylanguage)Server:(service)P1.4Businessproceduresmayhavethreeelements…………*/--executetheSQLstatement--1,usingdatabaseGrammar:--usedatabase--goExample:UseniitdbGoSelect*From
4、StudentAsetofcustomcolumns,columnchart,headerinformation(threekinds)--selectcolumnnames1,columnnames2,columnnames3,...Namesn--fromtablenameSelectStuNoas'ID','name'address''=StuNameaddressFromdbo.Student-two,connectorcharactersSelectStudent.StuNO,Student.Stu
5、Name,'',Student.sex'='descriptionofgender:FromStudentINTturnsintoCHAR:convertfunctionSelectStuName+'age:'+CONVERT(char(4),age)+'old'+'as'description'address:'+addressFromStudentSelectStuName+'age:'+CONVERT(char(4),age)+'old'+'minus10yearsafter'+CONVERT(char
6、(4),age-10)+'as'description'address:'+addressFromStudentAnynumberandratioofnumericalvalues,theresultisitself.SelectStuName+'age:'+CONVERT(char(4),age%300)+'old'+'as'description'address:'+addressFromStudentSelectspecificrows--1,comparisonoperatorNotequalto<>
7、=!Select*fromStudentwhereage=30Select*fromStudentwhereage>30--2,arithmeticoperator-+-*/%/*3,logicaloperatorNotandandor/ornegativeSelect*fromStudentWhereStuName='jordan'andage<40Select*fromStudentWhereStuName='jordan'orStuName='Yao'--4,rangevalue-between....
8、and...Select*fromStudentWhereagebetween30and50--5,isnullisnotnullSelect*fromStudentWhereaddressisnull--6,in,notinSelect*fromStudentWhereStuNOin('N001','N003','N005')-insteadofStuNO='N001'orStuNo='N003'