From the course: MySQL Advanced Topics (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Creating a joined view

Creating a joined view

- [Instructor] A view can be a simple query, or it can be a more complex joint query. The technique is the same. Here again, we're using the album database, and we have a joint select, which selects from both the track and the album tables. This query shows all the tracks for each album, with the duration as minutes and seconds. And when I execute all of this, you see we get the result that we expect. We have all of the albums in the database, with all the tracks, and everything separated out as minutes and seconds. Now, we can save this query as a view, very simply. We simply say, "create view," and we name it, and so we'll call this one "joined album", and "AS", and then the select statement. And when I execute this, we have created the view, and now we can select from that view, just as if it were a table, And there, we have the result that we expect. In fact, I can say, "where artist equals Jimi Hendrix,"…

Contents