this statement creates a new view, or replaces an existing one if the this statement requires the a view belongs to a database. by default, a new view is created in the current database. to create the view explicitly in a given database, specify the name as tables and views share the same namespace within a database, so a database cannot contain a table and a view that have the same name. views must have unique column names with no duplicates, just like base tables. by default, the names of the columns retrieved by the columns retrieved by the unqualified table or view names in the a view can be created from many kinds of a view definition is subject to the following restrictions: the the the within a stored routine, the definition cannot refer to routine parameters or local variables. any table or view referred to in the definition must exist. however, after a view has been created, it is possible to drop a table or view that the definition refers to. to check a view definition for problems of this kind, use the the definition cannot refer to a the tables named in the view definition must already exist. you cannot associate a trigger with a view.
Java
Asp
PHP
.Net
XML
C/C++
CGI
VB
Jsp
J2ee
J2se
J2me
EJB
Servlet
Tomcat
Resin
Struts
Weblogic
Eclipse
ANT
GUI
JMS
Web servise
IDEA
Webphere
Hibernate
Spring
Jboss
Applet
Swing
Socket
Javamail
Perl
Ajax
P2P
安全
模式
框架
测试
开源
游戏
Windows XP
Windows 2000
Windows 2003
Windows Me
Windows 9.x
Linux
UNIX
注册表
操作系统
服务器
应用服务器
基本语法:
create [or replace] [algorithm = {undefined merge temptable}] view view_name [(column_list)] as select_statement [with [cascaded local] check option]or replace clause is given. the select_statement is a select statement that provides the definition of the view. the statement can select from base tables or other views. create view privilege for the view, and some privilege for each column selected by the select statement. for columns used elsewhere in the select statement you must have the select privilege. if the or replace clause is present, you must also have the delete privilege for the view. db_name.view_name when you create it. mysql>
create view test.v as select * from t;select statement are used for the view column names. to define explicit names for the view columns, the optional column_list clause can be given as a list of comma-separated identifiers. the number of names in column_list must be the same as the number of columns retrieved by the select statement. select statement can be simple references to table columns. they can also be expressions that use functions, constant values, operators, and so forth. select statement are interpreted with respect to the default database. a view can refer to tables or views in other databases by qualifying the table or view name with the proper database name. select statements. it can refer to base tables or other views. it can use joins, union, and subqueries. the select need not even refer to any tables. the following example defines a view that selects two columns from another table, as well as an expression calculated from those columns: mysql>
create table t (qty int, price int);mysql> insert into t values(3, 50);mysql> create view v as select qty, price, qty*price as value from t;mysql> select * from v;+------+-------+-------+ qty price value +------+-------+-------+ 3 50 150 +------+-------+-------+select statement cannot contain a subquery in the from clause. select statement cannot refer to system or user variables. select statement cannot refer to prepared statement parameters. check table statement. temporary table, and you cannot create a temporary view.
关键字 本文所属关键字
相关 与本文相关文章
分类 所有文章关键字导航
源码编程相关
操作系统/服务器相关
标准 网站致力的规范