404 Tech Support

Creating and editing views in phpMyAdmin

Using phpMyAdmin recently for a database project, creating a View wasn’t readily apparent. I eventually found it and it’s right where it needs to be if you know where to look.

Creating a MySQL view through phpMyAdmin

You can create a table from multiple places in phpMyAdmin but creating a view only comes after completing a SQL query.

Create your query against the database to verify that you are getting the desired columns and the correct rows. Then at the bottom of the results page, you will see a box for ‘Query results operations’. Click the link for ‘Create view’. (It’s boxed in red in the image below.)

This will take you to a new page with new fields to fill out. If you are creating a new view, you should fill out the ‘VIEW name’ field and you can use the ‘Column names’ field if you would like the column names to be different from their original names in the View. The query you ran will be copied into the ‘AS’ field and you can modify it if you wish. (I would advise getting it right when just doing queries for simplicity sake.) If you want their original names, leave the field blank. Hit ‘Go’ and your View will be created.

If you are wanting to edit a view, check the “OR REPLACE” box at top and fill in the ‘VIEW name’ field with the exact name of the View you are wanting to update. Hit ‘Go’ and your View will be updated.

Once you have a View in your database, it will be listed on the left-column (you might have to click the refresh button above for it to appear) along with your tables. Views, however, have a different icon. Instead of just the Table icon, they sport an eyeball on top of the table.

You can now use and edit your View at your convenience.