COMMENT ON

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Sets a comment on a catalog, schema, table, share, recipient, or provider.

Catalogs, shares, recipients, and providers are supported in Unity Catalog only.

To set the comment of a table column, use ALTER TABLE.

Syntax

COMMENT ON
    { CATALOG catalog_name |
        { SCHEMA | DATABASE } schema_name |
        TABLE table_name |
        SHARE share_name |
        RECIPIENT recipient_name |
        PROVIDER provider_name }
    IS comment

Parameters

  • catalog_name

    The name of the catalog where your comment appears. To run this statement, you must be the owner of the catalog.

  • schema_name

    The name of the schema where your comment appears.

    If you use Unity Catalog, to run this statement, you must be the owner of the schema.

  • table_name

    The name of the table you comment on. The name must not include a temporal specification.

    If you use Unity Catalog, to run this statement, you must have MODIFY privilege on the table.

  • share_name

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 11.1 and above

    The name of the share where your comment appears. To run this statement, you must be the owner of the share.

  • recipient_name

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 11.1 and above

    The name of the recipient where your comment appears. To run this statement, you must be the owner of the recipient.

  • provider_name

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 11.1 and above

    The name of the provider where your comment appears. To run this statement, you must be the owner of the provider.

  • comment

    A STRING literal or NULL. If you specify NULL any existing comment is removed.

Examples

> COMMENT ON CATALOG my_catalog IS 'This is my catalog';

> COMMENT ON SCHEMA my_schema IS 'This is my schema';

> COMMENT ON TABLE my_table IS 'This is my table';

> COMMENT ON TABLE my_table IS NULL;

> COMMENT ON SHARE my_share IS 'A good share';

> COMMENT ON RECIPIENT my_recipient IS 'A good recipient';

> COMMENT ON PROVIDER my_provider IS 'A good provider';