DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info) describe

Info Catalog (mysql.info) basic-user-commands (mysql.info) basic-user-commands (mysql.info) use
 
 13.3.1 `DESCRIBE' Syntax
 ------------------------
 
      {DESCRIBE | DESC} TBL_NAME [COL_NAME | WILD]
 
 `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  show-columns.)
 
 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 quotes 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)
 
 `Field' indicates the column name.
 
 The `Null' field indicates whether `NULL' values can be stored in the
 column.
 
 The `Key' field indicates whether the column is indexed. A value of
 `PRI' indicates that the column is part of the table's primary key.
 `UNI' indicates that the column is part of a `UNIQUE' index. The `MUL'
 value indicates that multiple occurrences of a given value are allowed
 within the column.
 
 One reason for `MUL' to be displayed on a `UNIQUE' index is that
 several columns form a composite `UNIQUE' index; although the
 combination of the columns is unique, each column can still hold
 multiple occurrences of a given value. Note that in a composite index,
 only the leftmost column of the index has an entry in the `Key' field.
 
 Before MySQL 5.0.11, if the column allows `NULL' values, the `Key' value
 can be `MUL' even when a `UNIQUE' index is used. The rationale was that
 multiple rows in a `UNIQUE' index can hold a `NULL' value if the column
 is not declared `NOT NULL'. As of MySQL 5.0.11, the display is `UNI'
 rather than `MUL' regardless of whether the column allows `NULL'; you
 can see from the `Null' field whether or not the column can contain
 `NULL'.
 
 The `Default' field indicates the default value that is assigned to the
 column.
 
 The `Extra' field contains any additional information that is available
 about a given column. In the example shown, the `Extra' field indicates
 that the `Id' column was created with the `AUTO_INCREMENT' keyword.
 
 If the data types are different from what you expect them to be based
 on a `CREATE TABLE' statement, note that MySQL sometimes changes data
 types. See  silent-column-changes.
 
 The `DESCRIBE' statement is provided for compatibility with Oracle.
 
 The `SHOW CREATE TABLE' and `SHOW TABLE STATUS' statements also provide
 information about tables. See  show.
 
Info Catalog (mysql.info) basic-user-commands (mysql.info) basic-user-commands (mysql.info) use
automatically generated byinfo2html