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!
5 Answers
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
Special thanks to CheesConQueso for their insightful answer.
-
Who so ever looking at this answer, please update the
phpMyAdmin
to version4.9.0.1
, it includes the bug fix for that edit view thing.– HiteshCommented Aug 30, 2019 at 10:56
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.
-
1When I do this, I can't "edit" the view, but only replace it with a "new" view, starting from scratch. Commented May 12, 2019 at 9:28
-
Same here, getting a window with "new" view. Not seeing any SQL-code.– FlorisCommented Sep 5, 2019 at 14:12
-
Don't have "Edit View" in my version, which was confusing...– BillyT2Commented Nov 9, 2021 at 23:07
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
-
4maybe you could create a new view based upon the result of the command above and add your edits to it? Commented Nov 11, 2010 at 16:47
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