CREATE VIEW

Overview

Creates view of the database as specified from the given SELECT statement.

USAGE

Common Syntax:

CREATE [OR REPLACE]
   [ALGORITHM = {MERGE | TEMPTABLE}]
   [DEFINER = {CURRENT_USER | <user_spec>}]
   [SQL SECURITY {DEFINER | INVOKER}]
VIEW [IF NOT EXISTS] <view_name>

DETAILS

MariaDB Xpand's CREATE VIEW statement has some differences from MariaDB Enterprise Server:

  • The DEFINER = user clause is ignored

  • The SQL SECURITY { DEFINER | INVOKER } clause is ignored

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

CREATE VIEW

To create a view in the currently selected database:

CREATE
   VIEW 2022_01_invoices AS
      SELECT * FROM invoices
      WHERE MONTH(invoice_date) = 1 AND YEAR(invoice_date) = 2022;

Specify an Algorithm

To specify the algorithm used to process the view, specify the ALGORITHM clause:

CREATE
   ALGORITHM = TEMPTABLE
   VIEW 2022_01_invoices AS
      SELECT * FROM invoices
      WHERE MONTH(invoice_date) = 1 AND YEAR(invoice_date) = 2022;

Specify the Security Context

MariaDB Xpand supports the SQL SECURITY clause for compatibility, but the specified security context is ignored:

CREATE
   SQL SECURITY DEFINER
   VIEW 2022_01_invoices AS
      SELECT * FROM invoices
      WHERE MONTH(invoice_date) = 1 AND YEAR(invoice_date) = 2022;

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES