资源描述:
《select statement - ouselect语句中-欧》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、MicrosoftSQLSyntaxDataManipulationLanguageSELECTStatement2ALL,DISTINCT,DISTINCTROW,TOPPredicates3FROMClause6GROUPBYClause6HAVINGClause8INClause9INNERJOINOperation10LEFTJOIN,RIGHTJOINOperations12ORDERBYClause14SELECT...INTOStatement15UNIONOperation17WHEREClause18WITHOWNERACCESSOPTIONDeclaration2
2、0SQLAggregateFunctions20CountFunction21First,LastFunctions22CalculatingFieldsinSQLFunctions23Min,MaxFunctions23StDev,StDevPFunctions24SumFunction25Var,VarPFunctions26INSERTINTOStatement26DROPStatement28DELETEStatement29UPDATEStatement29SELECTStatementInstructstheMicrosoftJetdatabaseenginetoretu
3、rninformationfromthedatabaseasasetofrecords.SyntaxSELECT[predicate]{*
4、table.*
5、[table.]field1[ASalias1][,[table.]field2[ASalias2][,...]]}FROMtableexpression[,...][INexternaldatabase][WHERE...][GROUPBY...][HAVING...][ORDERBY...][WITHOWNERACCESSOPTION]TheSELECTstatementhastheseparts:PartDescriptio
6、npredicateOneofthefollowingpredicates:ALL,DISTINCT,DISTINCTROW,orTOP.Youusethepredicatetorestrictthenumberofrecordsreturned.Ifnoneisspecified,thedefaultisALL.*Specifiesthatallfieldsfromthespecifiedtableortablesareselected.tableThenameofthetablecontainingthefieldsfromwhichrecordsareselected.fiel
7、d1,field2Thenamesofthefieldscontainingthedatayouwanttoretrieve.Ifyouincludemorethanonefield,theyareretrievedintheorderlisted.alias1,alias2Thenamestouseascolumnheadersinsteadoftheoriginalcolumnnamesintable.tableexpressionThenameofthetableortablescontainingthedatayouwanttoretrieve.externaldatabas
8、eThenameofthedatabasecontainingthetablesintableexpressioniftheyarenotinthecurrentdatabase.RemarksToperformthisoperation,theMicrosoft®Jetdatabaseenginesearchesthespecifiedtableortables,extractsthechosencolumns,selectsrowsthatmeetthecriterion,andsortsorgroupstheresultingrowsintotheorderspecified.
9、SELECTstatementsdonotchangedatainthedatabase.SELECTisusuallythefirstwordinanSQLstatement.MostSQLstatementsareeitherSELECTorSELECT...INTOstatements.TheminimumsyntaxforaSELECTstatementis:SELECTfieldsFROMtableYoucanuseanasterisk(*)to