Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

SHOW COLUMN Statement

Description

Displays the column information of a table. You can use the LIKE clause to search the column names matching it. If you use the WHERE clause, you can search column names with more general terms like, "General Considerations for All SHOW Statements."  If you use the FULL keyword, the additional information of a column will be displayed as follows:

  • Field : Column name
  • Type : Column data type
  • Null : If you can store NULL, the value is YES and if not, it is NO
  • Key : Whether a column has an index or not. If there is more than one key value in the given column of a table, this displays only the one that appears first in the order of PRI, UNI and MUL.
    • If the key is a space, the column doesn't have an index, it is not the first column in the multiple column index or the index is non-unique.
    • If the value is PRI, it is a primary key or the primary key of multiple columns.
    • If the value is UNI, it is a unique index. (The unique index allows multiple NULL values but you can also set a NOT NULL constraint.)
    • If the value is MUL, it is the first column of the non-unique index that allows the given value to be displayed in the column several times. If the column composes a composite unique index, the value will be MUL. The combination of column values can be unique but the value of each column can appear several times.
  • Default : Default value defined in the column
  • Extra : Additional information available about the given column. AUTO_INCREMENT The column attribute must have the auto_increment value.

SHOW FIELDS is the same command as SHOW COLUMNS.

The DESCRIBE(abbreviated DESC) statement and the EXPLAIN statement provide similar information to SHOW COLUMNS.

Syntax

SHOW COLUMNS {FROM | IN} tbl_name [LIKE 'pattern' | WHERE expr]

Example

The following is the result of a query for the demodb.

SHOW COLUMNS FROM athlete;

  Field                 Type                  Null                  Key                   Default               Extra

====================================================================================================================================

  'code'                'INTEGER'             'NO'                  'PRI'                 NULL                  'auto_increment'

  'name'                'STRING(40)'          'NO'                  ''                    NULL                  ''

  'gender'              'CHAR(1)'             'YES'                 ''                    NULL                  ''

  'nation_code'         'CHAR(3)'             'YES'                 ''                    NULL                  ''

  'event'               'STRING(30)'          'YES'                 ''                    NULL                  ''

 

SHOW COLUMNS FROM athlete LIKE '%c%';

  Field                 Type                  Null                  Key                   Default               Extra

====================================================================================================================================

  'code'                'INTEGER'             'NO'                  'PRI'                 NULL                  'auto_increment'

  'nation_code'         'CHAR(3)'             'YES'                 ''                    NULL                  ''

 

SHOW COLUMNS FROM athlete  WHERE "type" = 'INTEGER' and "key"='PRI' AND extra='auto_increment';

  Field                 Type                  Null                  Key                   Default               Extra

====================================================================================================================================

  'code'                'INTEGER'             'NO'                  'PRI'                 NULL                  'auto_increment'