Syntax

SQL Create a View Syntax

In SQL, create a view: saves a query as a virtual table — CREATE VIEW active_users AS SELECT * FROM users WHERE active;

Quick Answer

Syntax
CREATE VIEW active_users AS SELECT * FROM users WHERE active;
SQLSyntax

Create a View

Code example
CREATE VIEW active_users AS SELECT * FROM users WHERE active;

Saves a query as a virtual table.

Learn More

How to create a view in SQL

  1. Open your SQL file or editor.
  2. Copy the example, then replace its sample names and values for your code.

SQL Create a View Syntax

Use CREATE VIEW active_users AS SELECT * FROM users WHERE active;.

Related Syntax References

Frequently asked questions

What is the SQL syntax for create a view?

Use this pattern: CREATE VIEW active_users AS SELECT * FROM users WHERE active;

Can I copy this SQL code example?

Yes. Use Copy code and adapt the example to your program.

Is this SQL syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify