是否可以从另一个视图创建视图?

时间:2022-07-30 10:20:37

It's probably a silly question but it is straight forward.

这可能是个愚蠢的问题,但它是直截了当的。

Is it possible to create a view from an existing view?

是否可能从现有视图创建视图?

Let's say I've tableA. I create vwtableA from tableA and now I want to create vvVwtableA from vwtableA.

假设我为多。我从tableA中创建vwtableA现在我想从vwtableA中创建vvVwtableA。

In pseudo-code it would be something like:

伪代码是这样的:

create view vwA as select * from tableA;
create view vwvwA as select * from vwA;

is this possible? I'm trying something like this and I get no MySQL errors executing the statment but I can't browse the second view... MySQL Workbench keeps loading for ever and I don't know if this may be the cause.

这是可能的吗?我尝试了这样的方法我没有MySQL错误执行状态但是我不能浏览第二个视图…MySQL Workbench一直在加载,我不知道这是否是原因。

My tableA has around 100 000 records, vwA has around 50 000 records and vwvwA should have around 50 000 as well.

我的tableA有10万张记录,vwA有5万张记录,vwvwA也应该有5万张记录。

2 个解决方案

#1


3  

Yes, it is possible. See MySQL documentation

是的,这是可能的。看到MySQL文档

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

select_statement是一个SELECT语句,它提供了视图的定义。(当您从视图中进行选择时,您实际上使用select语句进行选择)select_statement可以从基表或其他视图中进行选择

#2


0  

just make a copy of your first view (vwA) and create a new one (vwvwA) . Simple this way. ;-)

只需复制您的第一个视图(vwA)并创建一个新的视图(vwvwA)。这种方式简单。:-)

#1


3  

Yes, it is possible. See MySQL documentation

是的,这是可能的。看到MySQL文档

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

select_statement是一个SELECT语句,它提供了视图的定义。(当您从视图中进行选择时,您实际上使用select语句进行选择)select_statement可以从基表或其他视图中进行选择

#2


0  

just make a copy of your first view (vwA) and create a new one (vwvwA) . Simple this way. ;-)

只需复制您的第一个视图(vwA)并创建一个新的视图(vwvwA)。这种方式简单。:-)