Database Reference
In-Depth Information
For the second statement, mysql changes the prompt from mysql> to -> to let you know
that it's still waiting to see the statement terminator.
The ; and \g statement terminators are not part of the statement itself. They're con‐
ventions used by the mysql program, which recognizes these terminators and strips
them from the input before sending the statement to the MySQL server.
Some statements generate output lines that are so long they take up more than one line
on your terminal, which can make query results difficult to read. To avoid this problem,
generate “vertical” output by terminating the statement with \G rather than with ; or
\g . The output shows column values on separate lines:
mysql> SHOW FULL COLUMNS FROM limbs LIKE 'thing'\G
*************************** 1. row ***************************
Field: thing
Type: varchar(20)
Collation: latin1_swedish_ci
Null: YES
Key:
Default: NULL
Extra:
Privileges: select,insert,update,references
Comment:
To produce vertical output for all statements executed within a session, invoke mysql
with the -E (or --vertical ) option. To produce vertical output only for those results
that exceed your terminal width, use --auto-vertical-output .
To execute a statement directly from the command line, specify it using the -e (or --
execute ) option. This is useful for “one-liners.” For example, to count the rows in the
limbs table, use this command:
% mysql -e "SELECT COUNT(*) FROM limbs" cookbook
+----------+
| COUNT(*) |
+----------+
| 11 |
+----------+
To execute multiple statements, separate them with semicolons:
% mysql -e "SELECT COUNT(*) FROM limbs;SELECT NOW()" cookbook
+----------+
| COUNT(*) |
+----------+
| 11 |
+----------+
+---------------------+
| NOW() |
+---------------------+
| 2014-04-06 17:43:57 |
+---------------------+
Search WWH ::




Custom Search