Creating a View
In this lesson we will learn about three different ways of creating views.
Creating a View
Views are virtual tables that are created as a result of a SELECT query. They offer a number of advantages such as showing only a subset of data that is meaningful to users or restricting the number of rows and columns shown for security reasons. A view containing columns from multiple tables can simplify queries by changing a multi-table query to a single-table query against a view. Views are stored in the database along with tables.
A view can be created from a single table, by joining two tables, or from another view.
Syntax
CREATE [OR REPLACE] VIEW view_name AS
SELECT col1, col2, …coln
FROM table
WHERE < condition>
Connect to the terminal below by clicking in the widget. Once connected, the command line prompt will show up. Enter or copy and paste the command ...
Get hands-on with 1400+ tech skills courses.