hi,

i have a view in the database which queries about 6 tables to produce the results and works great.

however i need to create a view based on the info from this view along with data from another table.

when creating the view that queries the view and table is there anything i should know or should this work fine?

many thanks

I've seen that done a lot querying an Oracle database where I used to work. It worked fine. I haven't tried that in MySQL but I can't think of any reason that it wouldn't work.

Just keep in mind that if you do this a lot you may end up with a lot of views depending on a lot of views. If you want to change or delete some of these views (as in "let's do a clean-up") you need to remember which views depend on the views you want to change. I remember we had a lot of old views cluttering our database that nobody wanted to delete in case some report, procedure or other view used them. We finally had to get our act together and remove the unused views.

Hello,

The only thing I have ever notice is that when you query a view from another view is that it can be slower if the first view creates a large amount of output. You might want to simply add the query as an outer select to the syntax for the first view.

thanks for the help,

does views cause storage space on the database at all?

just when you mentioned views cluttering the database.

thanks again guys

No, views don't take up much space. The data are in the tables. Views are not much more than saved select statements plus some optional aliases of input and output columns, I think.

By 'cluttering' I meant we had many programmers creating views publicly available to everybody. It got tedious browsing through all the available names of views, some of them unused or redundant. This is not a downside specific to views. The more database objects you create that are dependant on each other, the more important it becomes to keep track of them and their relationships.

thank you again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.