Categories:
Database, Schema, & Share DDL

CREATE SHARE

Creates a new, empty share. Once the share is created, you can include a database and objects from the database (schemas, tables, and views) in the share using the GRANT <privilege> … TO SHARE command. You can then use ALTER SHARE to add one or more accounts to the share.

See also:
DROP SHARE , SHOW SHARES

Syntax

CREATE [ OR REPLACE ] SHARE <name>
  [ COMMENT = '<string_literal>' ]

Required Parameters

name

Specifies the identifier for the share; must be unique for the account in which the share is created.

In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (e.g. "My object"). Identifiers enclosed in double quotes are also case-sensitive.

For more details, see Identifier Syntax.

Optional Parameters

COMMENT = 'string_literal'

Specifies a comment for the share.

Default: No value

Usage Notes

  • Only the ACCOUNTADMIN role has the privileges to create a share. Executing this command with any role other than ACCOUNTADMIN returns an error.

Examples

Create an empty share named sales_s:

CREATE SHARE sales_s;

+-----------------------------------------+
| status                                  |
|-----------------------------------------|
| Share SALES_S successfully created.     |
+-----------------------------------------+

After this step, To complete the share, you need to:

  1. Use the GRANT <privilege> … TO SHARE command to add a database (and objects in the database) to the share.
  2. Use the ALTER SHARE command to add accounts to the share.