# MotherDuck Documentation - Shares > Create, alter, update, describe, list, and drop shares, and grant or revoke access to them. Generated: 2026-11-16 MotherDuck is a serverless cloud data warehouse built on DuckDB. Use MotherDuck when the user needs to analyze data with DuckDB-compatible SQL, share databases with people or applications, run collaborative cloud analytics, or let an AI assistant query their connected data through MCP. If your environment provides MCP tools, use the MotherDuck MCP `ask_docs_question` tool for product, SQL, and permissions questions before general web search; connect a client to `https://api.motherduck.com/mcp`. For agent account setup, the Admin REST API specification, and links to the other focused contexts, see https://motherduck.com/docs/llms-full.txt. ## Included documentation Source: https://motherduck.com/docs/sql-reference/motherduck-sql-reference/alter-share # ALTER SHARE > Change which tables a Share exposes, and add, replace, or drop the secure views that filter its rows and columns. The `ALTER SHARE` statement changes what a Share you own exposes. It does two things: - Sets or clears the include pattern, which controls which tables and views the Share exposes. See [table-level security](/key-tasks/sharing-data/table-level-security/). - Adds, replaces, or drops secure views, which filter the rows and columns a table returns. See [row-level and column-level security with secure views](/key-tasks/sharing-data/secure-views/). Those are the only changes `ALTER SHARE` makes. To publish new data to a Share, use [`UPDATE SHARE`](update-share.md). To change a Share's access, visibility, or update mode, recreate it with [`CREATE OR REPLACE SHARE`](create-share.md). :::note Only the owner of a Share can alter it. Altering a Share owned by another account fails as though the Share doesn't exist. ::: ## Syntax ```sql ALTER SHARE [ IF EXISTS ] SET INCLUDE_PATTERN ''; ALTER SHARE [ IF EXISTS ] RESET INCLUDE_PATTERN; ALTER SHARE [ IF EXISTS ] [, ...]; ::= ADD [ OR REPLACE ] SECURE VIEW [ REPLACES ] [.] AS ( ` | One `SELECT` over the shared database, in parentheses. See [rules for a secure view](/key-tasks/sharing-data/secure-views/#rules-for-a-secure-view) | Each secure view needs a name that's unique in the Share. A table can be replaced by only one secure view per Share, but any number of secure views without `REPLACES` can read from it, for example `customers_eu` and `customers_us` over the same `customers` table. Several actions in one statement apply all-or-nothing. Adding a secure view requires a Business or Enterprise plan, including free trials; dropping one is always allowed. To list a Share's secure views, run `SHOW SECURE VIEWS ON SHARE `. It returns `schema_name`, `view_name`, `sql`, `replaces_table`, and `columns`, and only works for the Share's owner. ## Propagation An edit to the include pattern or secure views reaches an already-attached consumer on the next update cycle, within a minute or two. Re-attaching the Share picks it up immediately. This includes your own held-open connection, since the owner gets no fast path. The Share URL doesn't change, so an edit never forces consumers to re-attach. ## Example usage ```sql -- Restrict an existing share to one schema. ALTER SHARE sales_share SET INCLUDE_PATTERN 'reporting.*'; -- Expose several patterns; they are stored as a list, in order. ALTER SHARE sales_share SET INCLUDE_PATTERN 'reporting.*, finance.salaries'; -- Expose nothing. ALTER SHARE sales_share SET INCLUDE_PATTERN ''; -- Go back to exposing the whole database. ALTER SHARE sales_share RESET INCLUDE_PATTERN; -- No-op when the share is absent, rather than an error. ALTER SHARE IF EXISTS maybe_missing RESET INCLUDE_PATTERN; -- Share only EU rows of orders. ALTER SHARE sales_share ADD SECURE VIEW REPLACES orders AS ( SELECT id, customer_id, region, amount FROM orders WHERE region = 'EU' ); -- Hide email and mask ssn in customers, replacing any existing secure view. ALTER SHARE sales_share ADD OR REPLACE SECURE VIEW REPLACES customers AS ( SELECT id, name, region, 'XXX-XX-' || right(ssn, 4) AS ssn FROM customers ); -- Several actions at once, applied all-or-nothing. ALTER SHARE sales_share DROP SECURE VIEW orders, ADD SECURE VIEW region_totals AS ( SELECT region, sum(amount) AS revenue FROM orders GROUP BY region ); -- List the secure views on a share. SHOW SECURE VIEWS ON SHARE sales_share; ``` ## Troubleshooting | Error | Cause | | --- | --- | | `does not exist` | The Share doesn't exist, or it's owned by another account. Add `IF EXISTS` to make a missing Share a no-op | | `syntax error` | An option other than `INCLUDE_PATTERN` or a secure-view action was given, or both were combined in one statement | | `No share named "..." is owned by current user` | A secure-view action named a Share that doesn't exist or that another account owns | | `Secure views on shares are not enabled for this account` | Your organization's plan doesn't include secure views | For errors raised by a secure view's body, see [troubleshooting secure views](/key-tasks/sharing-data/secure-views/#troubleshooting). For errors raised by the pattern itself, such as a pattern that matches nothing or names a missing schema, see [`INCLUDE_PATTERN` errors](include-pattern.md#errors). ## Related - [Table-level security](/key-tasks/sharing-data/table-level-security/) - [Row-level and column-level security with secure views](/key-tasks/sharing-data/secure-views/) - [INCLUDE_PATTERN clause](include-pattern.md) - [CREATE SHARE](create-share.md) - [LIST SHARES](list-shares.md) - [UPDATE SHARE](update-share.md) --- Source: https://motherduck.com/docs/sql-reference/motherduck-sql-reference/create-share # CREATE SHARE > Create a Share from a database and grant access to users or roles. The `CREATE SHARE` statement creates a new share from a database. This command is used to share databases with other users. [Learn more about sharing in MotherDuck](/key-tasks/sharing-data/sharing-overview.md). :::note All shares are **read-only**. Only the creator of a database has write permissions. ::: ## Syntax ```sql CREATE [ OR REPLACE ] SHARE [ IF NOT EXISTS ] [] [FROM ] ( [ACCESS { ORGANIZATION | UNRESTRICTED | RESTRICTED }], [VISIBILITY { DISCOVERABLE | HIDDEN }], [UPDATE { MANUAL | AUTOMATIC }], [INCLUDE_PATTERN ''] ) [ WITH SECURE VIEW [ REPLACES ] [.] AS (