Stats

1009 Contributors: 20 Monday, July 3, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

SELECT

Introduction

SELECT is used to retrieve rows selected from one or more tables.

Syntax

  • SELECT DISTINCT [expressions] FROM TableName [WHERE conditions]; ///Simple Select

  • SELECT DISTINCT(a), b ... is the same as SELECT DISTINCT a, b ...

  • SELECT [ ALL | DISTINCT | DISTINCTROW ] [ HIGH_PRIORITY ] [ STRAIGHT_JOIN ] [ SQL_SMALL_RESULT | SQL_BIG_RESULT ] [ SQL_BUFFER_RESULT ] [ SQL_CACHE | SQL_NO_CACHE ] [ SQL_CALC_FOUND_ROWS ] expressions FROM tables [WHERE conditions] [GROUP BY expressions] [HAVING condition] [ORDER BY expression [ ASC | DESC ]] [LIMIT [offset_value] number_rows | LIMIT number_rows OFFSET offset_value] [PROCEDURE procedure_name] [INTO [ OUTFILE 'file_name' options | DUMPFILE 'file_name' | @variable1, @variable2, ... @variable_n] [FOR UPDATE | LOCK IN SHARE MODE]; ///Full Select Syntax

Remarks

For more information on MySQL's SELECT statement, refer MySQL Docs.

Related Examples