Syntax\n------\n\nSELECT\n    [/+ hints /]\n    [/+ JOIN_PREFIX(argument_list) /]\n    [/+ JOIN_ORDER(argument_list) /]\n    [/+ JOIN_FIXED_ORDER(argument_list) /]\n    [/+ JOIN_SUFFIX(argument_list) /]\n    [/+ MAX_EXECUTION_TIME(milliseconds) /]\n    [ALL | DISTINCT | DISTINCTROW]\n    [HIGH_PRIORITY]\n    [STRAIGHT_JOIN]\n    [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n    [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n    select_expr [, select_expr ...]\n    [ FROM table_references\n      [WHERE where_condition]\n      [GROUP BY {col_name | expr | position} [ASC | DESC], ... [WITH ROLLUP]]\n      [HAVING where_condition]\n      [ORDER BY {col_name | expr | position} [ASC | DESC], ...]\n      [LIMIT {[offset,] row_count | row_count OFFSET offset  \n      [ROWS EXAMINED rows_limit] } |\n        [OFFSET start { ROW | ROWS }]\n        [FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }] ]\n      procedure|[PROCEDURE procedure_name(argument_list)]\n      [INTO OUTFILE 'file_name' [CHARACTER SET charset_name] [export_options] |\n        INTO DUMPFILE 'file_name' | INTO var_name [, var_name] ]\n      [FOR UPDATE lock_option | LOCK IN SHARE MODE lock_option]\nexport_options:\n    [{FIELDS | COLUMNS}\n        [TERMINATED BY 'string']\n        [[OPTIONALLY] ENCLOSED BY 'char']\n        [ESCAPED BY 'char']\n    ]\n    [LINES\n        [STARTING BY 'string']\n        [TERMINATED BY 'string']\n    ]\nlock_option:\n    [WAIT n | NOWAIT | SKIP LOCKED]\n\nDescription\n-----------\n\nSELECT is used to retrieve rows selected from one or more tables, and can include UNION statements and subqueries.\n\n Each select_expr expression indicates a column or data that you want to retrieve. You must have at least one select expression. See Select Expressions below.\n The FROM clause indicates the table or tables from which to retrieve rows. Use either a single table name or a JOIN expression. See JOIN for details. If no table is involved, FROM DUAL can be specified.\n Each table can also be specified as db_name.tabl_name. Each column can also be specified as tbl_name.col_name or even db_name.tbl_name.col_name. This allows one to write queries which involve multiple databases. See Identifier Qualifiers for syntax details.\n The WHERE clause, if given, indicates the condition or conditions that rows must satisfy to be selected. The where_condition is an expression that evaluates to true for each row to be selected. The statement selects all rows if there is no WHERE clause.\n   In the WHERE clause, you can use any of the functions and operators that MariaDB supports, except for aggregate (summary) functions. See Functions and Operators and Functions and Modifiers for use with GROUP BY (aggregate).\n Use the ORDER BY clause to order the results.\n Use the LIMIT clause to restrict the results to only a certain number of rows, optionally with an offset.\n Use the GROUP BY and HAVING clauses to group rows together when they have columns or computed values in common.\n\nSELECT can also be used to retrieve rows computed without reference to any table.\n\nSelect Expressions\n\nA SELECT statement must contain one or more select expressions, separated by commas. Each select expression can be one of the following:\n\n The name of a column.\n Any expression using functions and operators.\n  to select all columns from all tables in the FROM clause.\n tbl_name. to select all columns from just the table tbl_name.\n\nWhen specifying a column, you can either use just the column name or qualify the column name with the name of the table using tbl_name.col_name. The qualified form is useful if you are joining multiple tables in the FROM clause. If you do not qualify the column names when selecting from multiple tables, MariaDB will try to find the column in each table. It is an error if that column name exists in multiple tables.\n\nYou can quote column names using backticks. If you are qualifying column names with table names, quote each part separately as `tbl_name.col_name.\n\nIf you use any grouping functions in any of the select expressions, all rows in your results will be implicitly grouped, as if you had used GROUP BY NULL. GROUP BY NULL being an expression behaves specially such that the entire result set is treated as a group.\n\nDISTINCT\n\nA query may produce some identical rows. By default, all rows are retrieved, even when their values are the same. To explicitly specify that you want to retrieve identical rows, use the ALL option. If you want duplicates to be removed from the result set, use the DISTINCT option. DISTINCTROW is a synonym for DISTINCT. See also COUNT DISTINCT and SELECT UNIQUE in Oracle mode.\n\nINTO\n\nThe INTO clause is used to specify that the query results should be written to a file or variable.\n\n SELECT INTO OUTFILE - formatting and writing the result to an external file.\n SELECT INTO DUMPFILE - binary-safe writing of the unformatted results to an external file.\n* SELECT INTO Variable - selecting and setting variables.\n\nThe reverse of SELECT INTO OUTFILE is LOAD DATA.\n\nLIMIT\n\nRestricts the number of returned rows. See LIMIT and LIMIT ROWS EXAMINED for details.\n\nLOCK IN SHARE MODE/FOR UPDATE\n\nSee LOCK IN SHARE MODE and FOR UPDATE for details on the respective locking clauses.\n\nOFFSET ... FETCH\n\nSee SELECT ... OFFSET ... FETCH.\n\nThe clause doesn't exist.\n\nORDER BY\n\nOrder a result set. See ORDER BY for details.\n\nPARTITION\n\nSpecifies to the optimizer which partitions are relevant for the query. Other partitions will not be read. See Partition Pruning and Selection for details.\n\nPROCEDURE\n\nPasses the whole result set to a C Procedure. See PROCEDURE and PROCEDURE ANALYSE (the only built-in procedure not requiring the server to be recompiled).\n\nSKIP LOCKED\n\nThis causes rows that couldn't be locked (LOCK IN SHARE MODE or FOR UPDATE) to be excluded from the result set. An explicit NOWAIT is implied here. This is only implemented on InnoDB tables and ignored otherwise.\n\nThe clause doesn't exist.\n\nOptimizer Hints\n\nThese include HIGH_PRIORITY, STRAIGHT_JOIN, SQL_SMALL_RESULT | SQL_BIG_RESULT, SQL_BUFFER_RESULT, SQL_CACHE | SQL_NO_CACHE, and SQL_CALC_FOUND_ROWS.\n\nSee Optimizer Hints for details.\n\nmax_statement_time clause\n\nBy using max_statement_time in conjunction with SET STATEMENT, it is possible to limit the execution time of individual queries. For example:\n\n`sql\nSET STATEMENT max_statement_time=100 FOR \n  SELECT field1 FROM table_name ORDER BY field1;\n``\n\nWAIT/NOWAIT\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nExamples\n--------\n\nSELECT f1,f2 FROM t1 WHERE (f3<=10) AND (f4='y');\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select