bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL VIEW Keyword

Concept visual

SQL VIEW Keyword

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

VIEW Keyword

Previous

❮ SQL Keywords

Next

Create View

In SQL, a view is a virtual table based on the result set of an SQL statement.

The CREATE VIEW

command creates a view. The following SQL creates a view that selects all customers from Brazil:

Example

CREATE VIEW [Brazil Customers] AS

Select

CustomerName, ContactName

FROM Customers

Where

Country = "Brazil";

Query The View

We can query the view above as follows:

Example

SELECT * FROM [Brazil
Customers];

Create Or Replace View

The

Create Or Replace View

command updates a view. The following SQL adds the "City" column to the "Brazil Customers" view:

Example

CREATE OR REPLACE VIEW [Brazil Customers] AS SELECT CustomerName, ContactName, City

FROM Customers

WHERE Country = "Brazil";

Drop View

The DROP VIEW

command deletes a view. The following SQL drops the "Brazil Customers" view:

Example

DROP VIEW [Brazil Customers];

Previous

❮ SQL Keywords

Next

Previous

SQL VALUES Keyword

Next

SQL WHERE Keyword