Rechercher dans le manuel MySQL
13.7.6.13 SHOW CREATE VIEW Syntax
This statement shows the CREATE
VIEW
statement that creates the named view.
- *************************** 1. row ***************************
- View: v
- character_set_client: utf8mb4
- collation_connection: utf8mb4_0900_ai_ci
character_set_client
is the session value of
the character_set_client
system
variable when the view was created.
collation_connection
is the session value of
the collation_connection
system
variable when the view was created.
Use of SHOW CREATE VIEW
requires
the SHOW VIEW
privilege, and the
SELECT
privilege for the view in
question.
View information is also available from the
INFORMATION_SCHEMA
VIEWS
table. See
Section 25.36, “The INFORMATION_SCHEMA VIEWS Table”.
MySQL lets you use different
sql_mode
settings to tell the
server the type of SQL syntax to support. For example, you might
use the ANSI
SQL mode to
ensure MySQL correctly interprets the standard SQL concatenation
operator, the double bar (||
), in your
queries. If you then create a view that concatenates items, you
might worry that changing the
sql_mode
setting to a value
different from ANSI
could
cause the view to become invalid. But this is not the case. No
matter how you write out a view definition, MySQL always stores
it the same way, in a canonical form. Here is an example that
shows how the server changes a double bar concatenation operator
to a CONCAT()
function:
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.01 sec)
- *************************** 1. row ***************************
- View: v
- ...
The advantage of storing a view definition in canonical form is
that changes made later to the value of
sql_mode
will not affect the
results from the view. However an additional consequence is that
comments prior to SELECT
are
stripped from the definition by the server.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-show-create-view.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.