How to Create View in SQL Database: Standard SQL MySQL PostgreSQL MS SQL Server Oracle Operators: CREATE VIEW SELECT FROM WHERE AS Table of Contents Problem Example Solution Discussion Problem You want to create a view from a table in a database. Example We would like to create a view called it_employee with employees who work in the IT department, based on data from the table employee. Solution CREATE VIEW it_employee AS SELECT first_name, last_name FROM employee WHERE department = 'IT'; Discussion If you want to create a new view in a database, use the CREATE VIEW keyword followed by the name of the view (in our example: it_employee). Next is the keyword AS. Then in the SELECT statement, you specify the data you want to select and the table and the columns they come from. In our example, the table is employee, and the data are from the columns first_name and last_name. You can also use a WHERE clause to filter the records displayed in the view. In our example, we used WHERE to select only the employees who work in the IT department named (WHERE department='IT'). Of course, when creating a view, you can use any of the SELECT statement options, which can make the query more complex. Recommended courses: The Basics of Creating Tables Data Types in SQL SQL Constraints Recommended articles: What is a Primary Key in SQL? How to Create a Table in SQL Referential Constraints and Foreign Keys in MySQL Understanding Numerical Data Types in SQL See also: How to Create a Primary Key in SQL Subscribe to our newsletter Join our monthly newsletter to be notified about the latest posts. Email address How Do You Write a SELECT Statement in SQL? What Is a Foreign Key in SQL? Enumerate and Explain All the Basic Elements of an SQL Query