Creating Views on MySQL - Some Examples

Creating Views on MySQL - Some Examples

Last updated:

PHPMyAdmin

To create a view on PHPMyAdmin, you must click the Create view button after you run a query you want to create a view of:

phpmyadmin-create-view

MySQL console (command-line)

After you log into mysql and use the use command to select your database, you can create a new view using the CREATE VIEW syntax. Here's an example:

mysql> CREATE VIEW my_view AS SELECT * FROM posts ;

Notice the semi-colon (;) at the end. Just run it as you would a normal SQL statement.