MySQueaL Resources

resources for mysql admins and developers who are squealing for help

More Resources

Main Doc Pages
Privileges Required
  • SELECT
Comments
MySQL columns: everywhere I look are tables and columns; life is filled with databases of information to be ordered and grouped. (Heidelberg, Germany)

SELECT - Other Clauses & Options Statement

hits past month: 13 ;  last updated: may 4, 2009 - 2:34am ;  parent: SELECT

Syntax

SELECT [flags] {*|column|expression}[, ...]
FROM table[, ...]
[WHERE condition]
[other clauses]
[PROCEDURE procedure(arguments)]
[LOCK IN SHARE MODE|FOR UPDATE]

Explanation

To send the results of a SELECT statement as standard input to a procedure, use the PROCEDURE clause. The PROCEDURE keyword is followed by the name of the procedure, which can be followed by parenthese containing parameters to be passed to the procedure.

Examples

SELECT  * FROM employees
PROCEDURE ANALYSE(10, 225);

In this statement, the results of the SELECT statement are sent to the built in function ANALYSE( ) along with two numeric parameters. See ANALYSE( ) for more information on the function.

To lock the rows that are being selected from a table, the LOCK IN SHARE MODE keyword may be given at the end of the SELECT statement. This prevents other clients from changing the data while the SELECT statement is running. The FOR UPDATE option instructs MySQL to invoke a temporary write lock on the rows being selected. Both of these locks will be terminated when the statement is finished running.

Return to SELECT page of our MySQL Documentation