Creating Views on MySQL - Some Examples

Last updated:


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:


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.

Dialogue & Discussion