इस लेख में SQL SELECT
की सूची दी गई है सिंटैक्स, जैसा कि विभिन्न डेटाबेस प्रबंधन प्रणालियों (DBMS) द्वारा कार्यान्वित किया जाता है। सिंटैक्स को ठीक उसी तरह सूचीबद्ध किया गया है जैसे प्रत्येक विक्रेता ने इसे अपनी वेबसाइट पर सूचीबद्ध किया है। किसी विशेष विक्रेता के सिंटैक्स के बारे में अधिक विवरण देखने के लिए लागू लिंक पर क्लिक करें।
कवर किए गए DBMS में MySQL, SQL Server, PostgreSQL और Oracle डेटाबेस शामिल हैं।
MySQL
MySQL 5.7 संदर्भ मैनुअल से:
SELECT [ALL | DISTINCT | DISTINCTROW ] [HIGH_PRIORITY] [MAX_STATEMENT_TIME =N
] [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]select_expr
[,select_expr
...] [FROMtable_references
[PARTITIONpartition_list
] [WHEREwhere_condition
] [GROUP BY {col_name
|expr
|position
} [ASC | DESC], ... [WITH ROLLUP]] [HAVINGwhere_condition
] [ORDER BY {col_name
|expr
|position
} [ASC | DESC], ...] [LIMIT {[offset
,]row_count
|row_count
OFFSEToffset
}] [PROCEDUREprocedure_name
(argument_list
)] [INTO OUTFILE 'file_name
' [CHARACTER SETcharset_name
]export_options
| INTO DUMPFILE 'file_name
' | INTOvar_name
[,var_name
]] [FOR UPDATE | LOCK IN SHARE MODE]]
एसक्यूएल सर्वर
Transact-SQL संदर्भ से:
<SELECT statement> ::= [WITH <common_table_expression> [,...n]] <query_expression> [ ORDER BY { order_by_expression | column_position [ ASC | DESC ] } [ ,...n ] ] [ <FOR Clause>] [ OPTION ( <query_hint> [ ,...n ] ) ] <query_expression> ::= { <query_specification> | ( <query_expression> ) } [ { UNION [ ALL ] | EXCEPT | INTERSECT } <query_specification> | ( <query_expression> ) [...n ] ] <query_specification> ::= SELECT [ ALL | DISTINCT ] [TOP ( expression ) [PERCENT] [ WITH TIES ] ] < select_list > [ INTO new_table ] [ FROM { <table_source> } [ ,...n ] ] [ WHERE <search_condition> ] [ <GROUP BY> ] [ HAVING < search_condition > ]
PostgreSQL
PostgreSQL 9.5 मैनुअल से:
[ WITH [ RECURSIVE ] with_query [, ...] ] SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] [ * | expression [ [ AS ] output_name ] [, ...] ] [ FROM from_item [, ...] ] [ WHERE condition ] [ GROUP BY grouping_element [, ...] ] [ HAVING condition [, ...] ] [ WINDOW window_name AS ( window_definition ) [, ...] ] [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ] [ ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS { FIRST | LAST } ] [, ...] ] [ LIMIT { count | ALL } ] [ OFFSET start [ ROW | ROWS ] ] [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ] [ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF table_name [, ...] ] [ NOWAIT | SKIP LOCKED ] [...] ] where from_item can be one of: [ ONLY ] table_name [ * ] [ [ AS ] alias [ ( column_alias [, ...] ) ] ] [ TABLESAMPLE sampling_method ( argument [, ...] ) [ REPEATABLE ( seed ) ] ] [ LATERAL ] ( select ) [ AS ] alias [ ( column_alias [, ...] ) ] with_query_name [ [ AS ] alias [ ( column_alias [, ...] ) ] ] [ LATERAL ] function_name ( [ argument [, ...] ] ) [ WITH ORDINALITY ] [ [ AS ] alias [ ( column_alias [, ...] ) ] ] [ LATERAL ] function_name ( [ argument [, ...] ] ) [ AS ] alias ( column_definition [, ...] ) [ LATERAL ] function_name ( [ argument [, ...] ] ) AS ( column_definition [, ...] ) [ LATERAL ] ROWS FROM( function_name ( [ argument [, ...] ] ) [ AS ( column_definition [, ...] ) ] [, ...] ) [ WITH ORDINALITY ] [ [ AS ] alias [ ( column_alias [, ...] ) ] ] from_item [ NATURAL ] join_type from_item [ ON join_condition | USING ( join_column [, ...] ) ] and grouping_element can be one of: ( ) expression ( expression [, ...] ) ROLLUP ( { expression | ( expression [, ...] ) } [, ...] ) CUBE ( { expression | ( expression [, ...] ) } [, ...] ) GROUPING SETS ( grouping_element [, ...] ) and with_query is: with_query_name [ ( column_name [, ...] ) ] AS ( select | values | insert | update | delete ) TABLE [ ONLY ] table_name [ * ]
Oracle डेटाबेस
Oracle डेटाबेस ऑनलाइन दस्तावेज़ीकरण 12c . से रिलीज़ 1 (12.1):
subquery [ for_update_clause ] ;
यहां विकल्पों का अवलोकन दिया गया है।
सबक्वायरी::=
{ query_block | subquery { UNION [ALL] | INTERSECT | MINUS } subquery [ { UNION [ALL] | INTERSECT | MINUS } subquery ]... | ( subquery ) } [ order_by_clause ] [ row_limiting_clause ]
for_update_clause ::=
FOR UPDATE [ OF [ [ schema. ] { table | view } . ] column [, [ [ schema. ] { table | view } . ] column ]... ] [ { NOWAIT | WAIT integer | SKIP LOCKED } ]
घटक उपखंडों की व्याख्या के लिए आधिकारिक Oracle दस्तावेज़ देखें।
जीयूआई का उपयोग करना
अधिकांश DBMS GUI एक "क्वेरी बिल्डर" या जटिल क्वेरी बनाने के समान प्रदान करते हैं। उदाहरण के लिए, SQL सर्वर प्रबंधन स्टूडियो में क्वेरी डिज़ाइनर है जो यह कार्यक्षमता प्रदान करता है।