22
Using Views
In this chapter, you’ll learn exactly what views are, how they work, and when they should be used. You’ll also see how views can be used to simplify some of the SQL operations performed in earlier chapters.
Understanding Views
Note
This Chapter Requires MySQL 5 or Later Support for views was added to MySQL 5. Therefore, this chapter is applicable to MySQL 5 or later only.
Views are virtual tables. Unlike tables that contain data, views simply contain queries that dynamically retrieve data when used.
The best way to understand views is to look at an example. Back in Chapter 15, “Joining Tables,” you used the following SELECT
statement to retrieve data from three tables:
Input
SELECT cust_name ...
Get MySQL Crash Course, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.