COLUMNS
Applies to: Databricks SQL Databricks Runtime 10.4 LTS and above Unity Catalog only
INFORMATION_SCHEMA.COLUMNS describes columns of tables and views (relations) in the catalog.
The rows returned are limited to the relations the user is privileged to interact with.
Definition
The COLUMNS
relation contains the following columns:
Name |
Data type |
Nullable |
Standard |
Description |
---|---|---|---|---|
|
|
No |
Yes |
Catalog that contains the relation. |
|
|
No |
Yes |
Schema that contains the relation. |
|
|
No |
Yes |
Name of the relation the column is part of. |
|
|
No |
Yes |
Name of the column. |
|
|
No |
Yes |
The position (numbered from |
|
|
No |
Yes |
The default value used when the column is not specified in an INSERT, |
|
|
No |
Yes |
|
|
|
No |
No |
The data type as specified in the column definition. |
|
|
No |
Yes |
The simple data type name of the column, or |
|
|
Yes |
Yes |
Always |
|
|
Yes |
Yes |
Always |
|
|
Yes |
Yes |
For base-2 integral numeric types, |
|
|
Yes |
Yes |
For |
|
|
Yes |
Yes |
For integral numeric types 0, for |
|
|
Yes |
Yes |
For |
|
|
Yes |
Yes |
For |
|
|
Yes |
Yes |
Always |
|
|
Yes |
Yes |
Always |
|
|
No |
Yes |
Always ‘NO’, reserved for future use. |
|
|
Yes |
Yes |
Always |
|
|
Yes |
Yes |
Always |
|
|
Yes |
Yes |
Always |
|
|
Yes |
Yes |
Always |
|
|
Yes |
Yes |
Always |
|
|
Yes |
Yes |
Always |
|
|
Yes |
Yes |
Always |
|
|
Yes |
Yes |
Always |
|
|
No |
Yes |
Always |
|
|
No |
Yes |
Always |
|
|
Yes |
Yes |
Always |
|
|
No |
Yes |
|
|
|
Yes |
No |
Position (numbered from |
|
|
Yes |
No |
Optional description of the column. |
Constraints
The following constraints apply to the COLUMNS
relation:
Class |
Name |
Column List |
Description |
---|---|---|---|
Primary key |
|
|
Unique identifier for the column. |
Unique key |
|
|
Unique identifier the column. |
Foreign key |
|
|
References TABLES. |
Examples
-- Show the columns of the CATALOG_PRIVILEGES relation in the main.information_schema schema.
> SELECT ordinal_position, column_name, data_type
FROM main.information_schema.columns
WHERE table_schema = 'information_schema'
AND table_name = 'catalog_privileges'
ORDER BY ordinal_position;
1 grantor STRING
2 grantee STRING
3 catalog_name STRING
4 privilege_type STRING
5 is_grantable STRING