How can I edit a view using phpMyAdmin 3.2.4?
MysqlDatabasePhpmyadminMysql Problem Overview
I need to simply edit a very complicated view in phpMyAdmin 3.2.4 but I cannot figure how to do that. Any suggestions? Thanks!
Mysql Solutions
Solution 1 - Mysql
To expand one what CheeseConQueso is saying, here are the entire steps to update a view using PHPMyAdmin:
- Run the following query:
SHOW CREATE VIEW your_view_name
- Expand the options and choose Full Texts
- Press Go
- Copy entire contents of the Create View column.
- Make changes to the query in the editor of your choice
- Run the query directly (without the
CREATE VIEW
... syntax) to make sure it runs as you expect it to. - Once you're satisfied, click on your view in the list on the left to browse its data and then scroll all the way to the bottom where you'll see a CREATE VIEW link. Click that.
- Place a check in the OR REPLACE field.
- In the VIEW name put the name of the view you are going to update.
- In the AS field put the contents of the query that you ran while testing (without the
CREATE VIEW...
syntax). - Press Go
I hope that helps somebody. Special thanks to CheesConQueso for his/her insightful answer.
Solution 2 - Mysql
In your database table list it should show View in Type column. To edit View:
- Click on your View in table list
- Click on Structure tab
- Click on Edit View under Check All
Hope this help
update: in PHPMyAdmin 4.x, it doesn't show View in Type, but you can still recognize it:
- In Row column: It had zero Row
- In Action column: It had greyed empty button
Of course it may be just an empty table, but when you open the structure, you will know whether it's a table or a view.
Solution 3 - Mysql
try running SHOW CREATE VIEW my_view_name
in the sql portion of phpmyadmin and you will have a better idea of what is inside the view
Solution 4 - Mysql
Just export you view and you will have all SQL need to make some change on it.
Just need to add your change in SQL query for the view and change :
CREATE for CREATE OR REPLACE