COMMENT ON

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

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

Note

If you want to add an AI-generated comment for a table or table column managed by Unity Catalog, see Add AI-generated comments to Unity Catalog objects.

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 |
      CONNECTION connection_name |
      PROVIDER provider_name |
      RECIPIENT recipient_name |
      { SCHEMA | DATABASE } schema_name |
      SHARE share_name |
      TABLE table_name |
      VOLUME volume_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.

  • connection_name

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 13.3 LTS and above check marked yes Unity Catalog only

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

  • 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 or options 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.3 LTS 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.3 LTS 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.3 LTS and above

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

  • volume_name

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 13.3 LTS and above

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

  • 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 CONNECTION mysql_connection IS 'this is a mysql connection';

> 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';

> COMMENT ON PROVIDER my_volume IS 'Huge volume';