From the course: MySQL Advanced Topics
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Creating a joined view - MySQL Tutorial
From the course: MySQL Advanced Topics
Creating a joined view
- [Bill] Hi, I am Bill Weinman. A view can be a simple query or it can be a more complex joined query. The technique is the same. I've copied this block of SQL from the chapter two exercise file. We'll go ahead and use the album database. And here's a joined query select statement. You notice I have my duration as minutes and seconds with the div and mod, and I'm joining the track and album tables to get combined information. And so I'll go ahead and I'll execute this. And you see our result, we have artist, album, and then track, and we have all of our tracks from all of our albums in the database. So I can take that query and I can create a view. So I use the create view statement and the joinedAlbum name. And then, as clause is where I put the select statement, and that's exactly the same select statement that we just executed. So I'll go ahead and I'll create that view. And you see that's successful. And now I can just select artists from joinedAlbum, and I'll get the query from…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.