开发者

How can I see the Original MySQL used to create a view in phpMyAdmin or other program?

开发者 https://www.devze.com 2023-04-03 12:14 出处:网络
How can I see the original MySQL used to create a view in phpMyAdmin or other program? I am using phpMyAdmin version 3.3.9.

How can I see the original MySQL used to create a view in phpMyAdmin or other program?

I am using phpMyAdmin version 3.3.9.

This post tells how to see the SQL used to create a view but its not the original SQL used. How can I edit a view using phpMyAdmin 3.2.4?

The code returned works, it just doesn't have my original f开发者_Python百科ormat making it harder to edit. Is there a program to make this easier or do I need to save my original SQL in a text file somewhere?

Example:

SQL Used:

CREATE VIEW `wheel`.`new_view` AS
SELECT
`t_ci_sessions`.`session_id`,
`t_ci_sessions`.`ip_address`,
`t_ci_sessions`.`user_agent`,
`t_ci_sessions`.`last_activity`,
`t_ci_sessions`.`user_data`
FROM `wheel`.`t_ci_sessions`;
SELECT * FROM `wheel`.`ci_sessions`;

SQL phpMyAdmin Returns:

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `new_view` AS select `t_ci_sessions`.`session_id` AS `session_id`,`t_ci_sessions`.`ip_address` AS `ip_address`,`t_ci_sessions`.`user_agent` AS `user_agent`,`t_ci_sessions`.`last_activity` AS `last_activity`,`t_ci_sessions`.`user_data` AS `user_data` from `t_ci_sessions`


You can't find out the exact SQL used to create a view, but you can see the parsed version of it, which will of course be very close and semantically exactly the same, using this command:

show create view my_view_name;


Information schema have the definition of the views:

SELECT VIEW_DEFINITION 
FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_NAME = 'viewName'
0

精彩评论

暂无评论...
验证码 换一张
取 消