Coginiti menu Coginiti menu

Create a View

How to Create a View in SQL

Views are virtual tables that you can use to simplify complex queries or present data in a more user-friendly format. CREATE VIEW is the statement to create this virtual table based on your SQL query results.

Here’s the syntax:

CREATE VIEW view_name 
AS SELECT * 
FROM table  
WHERE condition; 

In this statement, view_name is the name you want to give the view, table is the name of the table that you want to base the view on, and “condition” specifies which rows of the table should be included. You can also specify which columns from the table should be included in the view by listing them after the SELECT keyword.

Once you’ve created a view, you can use it like a table in SQL queries, joining it with other tables or filtering data.

Using Coginiti, you can reverse engineer a view using our scripts. You can pick a view, then right-click and go to DDL Scripts to view the SQL executed to build that view.

Gif shows the right-click and opening of the DDL Scripts to see all rules used to build the view.