Home > Database > Mysql Tutorial > mysql之视图_MySQL

mysql之视图_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:30:34
Original
1165 people have browsed it

bitsCN.com

mysql之视图

 

创建视图语法如下:

CREATE VIEW view_name AS select_statement
Copy after login

其中

view_name标识视图名称,用户自行指定;

select_statement 是一种SELECT语句,它给出了视图的定义。该语句可从基表或其他视图进行选择对于在SELECT语句中其他地方使用的列,必须具有SELECT权限

视图注意事项:

SELECT语句不能包含FROM子句中的子查询。

SELECT语句不能引用系统或用户变量。

SELECT语句不能引用预处理语句参数。

在存储子程序内,定义不能引用子程序参数或局部变量。

在定义中引用的表或视图必须存在。但是,创建了视图后,能够舍弃定义引用的表或视图。要想检查视图定义是否存在这类问题,可使用CHECK TABLE语句。

在定义中不能引用TEMPORARY表,不能创建TEMPORARY视图。

在视图定义中命名的表必须已存在。

不能将触发程序与视图关联在一起。

例:

create view v as select goods_id,goods_name,shop_price from goods;使用视图:SELECT * FROM v;查看创建给定视图的CREATE VIEW语句show create view v删除视图drop view v;
Copy after login

 


bitsCN.com
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template