mysql檢視是從一個或多個表中匯出來的表:
建立檢視的語句:
一。首先查詢
select select_priv,create_view_priv from mysql.user where user ='root';
二。建立檢視
create view depart_view as select * from depart;
查詢試圖結構:desc depart_view;
第二鍾建立檢視:
create view depart_view2(id,name) as select id,name from
depart;
以上是單表上建立檢視;
多表的檢視建立:
create algorithm=merge view student_view1(id,name,sex) as select worker.id,name,sex from worker,student where worker.id = student.w_id with local check option;
檢視檢視的方法:
1。describe student_view1;
2.show create view student_view1;
3.show table status like '檢視名' ;
所有檢視定義都存在information_schema資料庫下的views表中。查詢views表,可以檢視到資料庫中所有檢視的詳細資訊。查詢的語句如下:
select * from information_schema.views;