CREATE VIEW
Syntax
1050
8 rows in set (0.00 sec)
mysql>
SELECT * FROM test2;
+------+
| a2 |
+------+
| 1 |
| 3 |
| 1 |
| 7 |
| 1 |
| 8 |
| 4 |
| 4 |
+------+
8 rows in set (0.00 sec)
mysql>
SELECT * FROM test3;
+----+
| a3 |
+----+
| 2 |
| 5 |
| 6 |
| 9 |
| 10 |
+----+
5 rows in set (0.00 sec)
mysql>
SELECT * FROM test4;
+----+------+
| a4 | b4 |
+----+------+
| 1 | 3 |
| 2 | 0 |
| 3 | 1 |
| 4 | 2 |
| 5 | 0 |
| 6 | 0 |
| 7 | 1 |
| 8 | 1 |
| 9 | 0 |
| 10 | 0 |
+----+------+
10 rows in set (0.00 sec)
13.1.12.
CREATE VIEW
Syntax
CREATE
[OR REPLACE]
[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = {
user
| CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]
VIEW
view_name
[(
column_list
)]
AS
select_statement
[WITH [CASCADED | LOCAL] CHECK OPTION]
The
CREATE VIEW
statement creates a new view, or replaces an existing one if the
OR REPLACE
clause is given. This statement was added in MySQL 5.0.1. If the view does not exist,
CREATE OR
REPLACE VIEW
is the same as
CREATE VIEW
. If the view does exist,
CREATE OR REPLACE VIEW
is
the same as
ALTER VIEW
.
The
select_statement
is a
SELECT
statement that provides the definition of the view. (When you
select from the view, you select in effect using the
SELECT
statement.)
select_statement
can
select from base tables or other views.
The view definition is “frozen” at creation time, so changes to the underlying tables afterward do not
affect the view definition. For example, if a view is defined as
SELECT *
on a table, new columns
added to the table later do not become part of the view.
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...