MySQL Utility Statements
1210
•
QUERY CACHE
Removes all query results from the query cache.
•
SLAVE
Makes the slave forget its replication position in the master binary logs. Also resets the relay log by
deleting any existing relay log files and beginning a new one.
13.8. MySQL Utility Statements
13.8.1.
DESCRIBE
Syntax
The
DESCRIBE
and
EXPLAIN
statements are synonyms, used either to obtain information about table
structure or query execution plans. For more information, see
Section 13.8.2, “
EXPLAIN
Syntax”
.
13.8.2.
EXPLAIN
Syntax
{EXPLAIN | DESCRIBE | DESC}
tbl_name
[
col_name
|
wild
]
{EXPLAIN | DESCRIBE | DESC}
[EXTENDED] SELECT
select_options
The
DESCRIBE
and
EXPLAIN
statements are synonyms. In practice, the
DESCRIBE
keyword is more
often used to obtain information about table structure, whereas
EXPLAIN
is used to obtain a query
execution plan (that is, an explanation of how MySQL would execute a query). The following discussion
uses the
DESCRIBE
and
EXPLAIN
keywords in accordance with those uses, but the MySQL parser
treats them as completely synonymous.
Obtaining Table Structure Information
DESCRIBE
provides information about the columns in a table. It is a shortcut for
SHOW COLUMNS
FROM
. As of MySQL 5.0.1, these statements also display information for views. (See
Section 13.7.5.5,
“
SHOW COLUMNS
Syntax”
.)
col_name
can be a column name, or a string containing the SQL “
%
” and “
_
” wildcard characters to
obtain output only for the columns with names matching the string. There is no need to enclose the
string within quotation marks unless it contains spaces or other special characters.
mysql>
DESCRIBE City;
+------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+----------+------+-----+---------+----------------+
| Id | int(11) | NO | PRI | NULL | auto_increment |
| Name | char(35) | NO | | | |
| Country | char(3) | NO | UNI | | |
| District | char(20) | YES | MUL | | |
| Population | int(11) | NO | | 0 | |
+------------+----------+------+-----+---------+----------------+
5 rows in set (0.00 sec)
The description for
SHOW COLUMNS
provides more information about the output columns (see
Section 13.7.5.5, “
SHOW COLUMNS
Syntax”
).
If the data types differ from what you expect them to be based on a
CREATE TABLE
statement, note
that MySQL sometimes changes data types when you create or alter a table. The conditions under
which this occurs are described in
Section 13.1.10.3, “Silent Column Specification Changes”
.
The
DESCRIBE
statement is provided for compatibility with Oracle.
The
SHOW CREATE TABLE
,
SHOW TABLE STATUS
, and
SHOW INDEX
statements also provide
information about tables. See
Section 13.7.5, “
SHOW
Syntax”
.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...