MySQL 如何使用 phpMyAdmin 3.2.4 编辑视图?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2279240/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I edit a view using phpMyAdmin 3.2.4?
提问by TheDarkMist
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!
我需要在 phpMyAdmin 3.2.4 中简单地编辑一个非常复杂的视图,但我不知道如何做到这一点。有什么建议?谢谢!
回答by KyleFarris
To expand one what CheeseConQueso is saying, here are the entire steps to update a view using PHPMyAdmin:
为了扩展 CheeseConQueso 所说的内容,以下是使用 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 Viewcolumn.
- 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 VIEWlink. Click that.
- Place a check in the OR REPLACEfield.
- In the VIEW nameput the name of the view you are going to update.
- In the ASfield put the contents of the query that you ran while testing (without the
CREATE VIEW...
syntax). - Press Go
- 运行以下查询:
SHOW CREATE VIEW your_view_name
- 展开选项并选择全文
- 按围棋
- 复制“创建视图”列的全部内容。
- 在您选择的编辑器中更改查询
- 直接运行查询(不带
CREATE VIEW
... 语法)以确保它按预期运行。 - 满意后,单击左侧列表中的视图以浏览其数据,然后一直滚动到底部,您将在其中看到CREATE VIEW链接。单击那个。
- 在OR REPLACE字段中打勾。
- 在VIEW 名称中输入您要更新的视图的名称。
- 在AS字段中放置您在测试时运行的查询的内容(没有
CREATE VIEW...
语法)。 - 按围棋
I hope that helps somebody. Special thanks to CheesConQueso for his/her insightful answer.
我希望这可以帮助某人。特别感谢 CheesConQueso 富有洞察力的回答。
回答by CheeseConQueso
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
尝试SHOW CREATE VIEW my_view_name
在 phpmyadmin 的 sql 部分运行,您将更好地了解视图中的内容
回答by Rivalus
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:
更新:在 PHPMyAdmin 4.x 中,它不显示 View in Type,但您仍然可以识别它:
- 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.
当然它可能只是一个空表,但是当你打开结构时,你就会知道它是一个表还是一个视图。
回答by PHPascal
Just export you view and you will have all SQL need to make some change on it.
只需导出您的视图,您将拥有所有 SQL 需要对其进行一些更改。
Just need to add your change in SQL query for the view and change :
只需要在视图的 SQL 查询中添加更改并更改:
CREATEfor CREATE OR REPLACE
CREATE为CREATE OR REPLACE