You may use any of several terminators to end a statement. Two terminators are the semicolon character (';') and the \g sequence. They're equivalent and may be used interchangeably: mysql> SELECT VERSION(), DATABASE(); +----------------+-------------+ | VERSION() | DATABASE() | +----------------+-------------+ | 5.0.10-beta-log | world | +----------------+-------------+ mysql> SELECT VERSION(), DATABASE()\g +----------------+-------------+ | VERSION() | DATABASE() | +----------------+-------------+ | 5.0.10-beta-log | world | +----------------+-------------+ The \G sequence also terminates queries, but causes mysql to display query results in a vertical style that shows each output row with each column value on a separate line: mysql> SELECT VERSION(), DATABASE()\G *************************** 1. row *************************** VERSION(): 5.0.10-beta-log DATABASE(): world The \G terminator is especially useful if a query produces very wide output lines because vertical format can make the result much easier to read. If you are using mysql to define a stored routine or a trigger that uses compound statement syntax and consists of multiple statements, the definition will contain semicolons internally. In this case, it is necessary to redefine the ';' terminator to cause mysql to pass semicolons in the definition to the server rather than interpreting them itself. Terminator redefinition is covered in Section 18.4, "Defining Stored Routines." |