[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You can use db_name.tbl_name
as an alternative to the tbl_name
FROM db_name
syntax. These two statements are equivalent:
mysql> SHOW INDEX FROM mytable FROM mydb; mysql> SHOW INDEX FROM mydb.mytable; |
SHOW DATABASES
lists the databases on the MySQL server host.
You can also get this list using the mysqlshow
command line tool.
In version 4.0.2 you will see only those databases for which you have some
kind of privilege, if you don't have the global SHOW DATABASES
privilege.
SHOW TABLES
lists the tables in a given database. You can also
get this list using the mysqlshow db_name
command.
Note: If a user doesn't have any privileges for a table, the table
will not show up in the output from SHOW TABLES
or mysqlshow
db_name
.
SHOW OPEN TABLES
lists the tables that are currently open in
the table cache. See section 7.4.8 How MySQL Opens and Closes Tables. The Comment
field tells
how many times the table is cached
and in_use
.
SHOW COLUMNS
lists the columns in a given table. If you specify
the FULL
option, you will also get the privileges you have for
each column. If the column types are different from what you expect them to
be based on a CREATE TABLE
statement, note that MySQL
sometimes changes column types. See section 13.2.5.1 Silent Column Specification Changes.
As of MySQL 4.1, the FULL
keyword also causes any per-column comments
to be displayed.
The DESCRIBE
statement provides information similar to
SHOW COLUMNS
.
See section DESCRIBE
.
SHOW FIELDS
is a synonym for SHOW COLUMNS
, and
SHOW KEYS
is a synonym for SHOW INDEX
. You can also
list a table's columns or indexes with mysqlshow db_name tbl_name
or mysqlshow -k db_name tbl_name
.
SHOW INDEX
returns the index information in a format that closely
resembles the SQLStatistics
call in ODBC. The following columns
are returned:
Column | Meaning |
Table | Name of the table. |
Non_unique | 0 if the index can't contain duplicates, 1 if it can. |
Key_name | Name of the index. |
Seq_in_index | Column sequence number in index, | starting with 1.
Column_name | Column name. |
Collation | How the column is sorted in the index. | In MySQL, this can have values `A' (Ascending) or
Cardinality | Number of unique values in the index. | This is updated by running
Sub_part | Number of indexed characters if the | column is only partly indexed.
Packed | Indicates how the key is packed. NULL if it is not. |
Null | Contains YES if the column may contain NULL . |
Index_type | Index method used. |
Comment | Various remarks. For now, it tells | in MySQL < 4.0.2 whether or not index is
Note that as the Cardinality
is counted based on statistics
stored as integers, it's not necessarily accurate for small tables.
The Packed
and Comments
columns were added in MySQL 3.23.0.
The Null
and Index_type
columns were added in MySQL 4.0.2.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |