DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(mysql.info.gz) DESCRIBE

Info Catalog (mysql.info.gz) Basic User Commands (mysql.info.gz) Basic User Commands (mysql.info.gz) USE
 
 13.3.1 `DESCRIBE' Syntax (Get Information About Columns)
 --------------------------------------------------------
 
      {DESCRIBE | DESC} TBL_NAME [COL_NAME | WILD]
 
 `DESCRIBE' provides information about a table's columns.  It is a
 shortcut for `SHOW COLUMNS FROM'.   `SHOW COLUMNS' 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 in
 quotes unless it contains spaces or other special characters.
 
      mysql> DESCRIBE city;
      +------------+----------+------+-----+---------+----------------+
      | Field      | Type     | Null | Key | Default | Extra          |
      +------------+----------+------+-----+---------+----------------+
      | Id         | int(11)  |      | PRI | NULL    | auto_increment |
      | Name       | char(35) |      |     |         |                |
      | Country    | char(3)  |      | UNI |         |                |
      | District   | char(20) | YES  | MUL |         |                |
      | Population | int(11)  |      |     | 0       |                |
      +------------+----------+------+-----+---------+----------------+
      5 rows in set (0.00 sec)
 
 The `Null' column indicates whether NULL values can be stored, with YES
 displayed when NULL values are allowed.
 
 The `Key' column indicates whether the field is indexed. A value of
 `PRI' indicates that the field is part of the table's primary key.
 `UNI' indicates that the field is part of a `UNIQUE' index. The `MUL'
 value indicates that multiple occurrences of a given value allowed
 within the field.
 
 A field can be designated as `MUL' even if a `UNIQUE' index is used if
 `NULL' values are allowed, as multiple rows in a `UNIQUE' index can hold
 a `NULL' value if the column is not declared `NOT NULL'. Another cause
 for `MUL' on a `UNIQUE' index is when two columns form a composite
 `UNIQUE' index; while the combination of the columns will be unique,
 each column can still hold multiple occurences of a given value. Note
 that in a composite index only the leftmost field of the index will
 have an entry in the `Key' column.
 
 The `Default' column indicates the default value that is assigned to
 the field.
 
 The `Extra' column contains any additional information that is
 available about a given field. In our example the `Extra' column
 indicates that our `Id' column was created with the `AUTO_INCREMENT'
 keyword.
 
 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.   Silent column changes.
 
 The `DESCRIBE' statement is provided for Oracle compatibility.
 
 The `SHOW CREATE TABLE' and `SHOW TABLE STATUS' statements also provide
 information about tables.   `SHOW' SHOW.
 
Info Catalog (mysql.info.gz) Basic User Commands (mysql.info.gz) Basic User Commands (mysql.info.gz) USE
automatically generated byinfo2html