Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to create a view from another view?

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.

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.

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

like image 964
dazito Avatar asked Apr 11 '13 03:04

dazito


Video Answer


1 Answers

Yes, it is possible. See MySQL documentation

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

like image 150
Dmitry Frenkel Avatar answered Nov 16 '22 01:11

Dmitry Frenkel