Sample Video Frame

Created by Zed A. Shaw Updated 2024-07-27 03:36:01
 

Exercise 21: Using Views

A VIEW is a fake table that is populated with the results of a SELECT query you write. Since every SELECT returns a table, it makes sense that you could make those tables permanent. Constructing a VIEW is similar to a combination of the CREATE TABLE statement and the sub-SELECT statement you just learned. If you find yourself frequently using a sub-select or the same query repeatedly, then consider making it a view so you can use the data better.

Here's an example that uses a query from Exercise 16:

View Source file ex21.sql Only

Previous Lesson Next Lesson

Register for Learn SQL the Hard Way

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.