139

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!

KyleFarris
  • 17,274
  • 5
  • 40
  • 40
TheDarkMist
  • 1,515
  • 2
  • 10
  • 6

5 Answers5

232

To expand one what CheeseConQueso is saying, here are the entire steps to update a view using PHPMyAdmin:

  1. Run the following query: SHOW CREATE VIEW your_view_name
  2. Expand the options and choose Full Texts
  3. Press Go
  4. Copy entire contents of the Create View column.
  5. Make changes to the query in the editor of your choice
  6. Run the query directly (without the CREATE VIEW... syntax) to make sure it runs as you expect it to.
  7. 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.
  8. Place a check in the OR REPLACE field.
  9. In the VIEW name put the name of the view you are going to update.
  10. In the AS field put the contents of the query that you ran while testing (without the CREATE VIEW... syntax).
  11. Press Go

Special thanks to CheesConQueso for their insightful answer.

starball
  • 20,030
  • 7
  • 43
  • 238
KyleFarris
  • 17,274
  • 5
  • 40
  • 40
  • Who so ever looking at this answer, please update the `phpMyAdmin` to version `4.9.0.1`, it includes the bug fix for that edit view thing. – Hitesh Aug 30 '19 at 10:56
64

In your database table list it should show View in Type column. To edit View:

  1. Click on your View in table list
  2. Click on Structure tab
  3. Click on Edit View under Check All

enter image description here

Hope this help

update: in PHPMyAdmin 4.x, it doesn't show View in Type, but you can still recognize it:

  1. In Row column: It had zero Row
  2. 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.

AdamsTips
  • 1,648
  • 17
  • 22
Rivalus
  • 1,052
  • 9
  • 10
46

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

CheeseConQueso
  • 5,831
  • 29
  • 93
  • 126
10

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

PHPascal
  • 109
  • 1
  • 2
0

Select your view in Bookmarked SQL query section then select Delete then click Go button.

user2511140
  • 1,658
  • 3
  • 26
  • 32