开发者

how to "extract" mysql view object?

I want to dump only view object from mysql databases in the following format :

CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW 
`v_sample` AS 
SELECT
  `a`.`id`                  AS `id`,
  `a`.`code`                AS `active`开发者_Python百科,
  `a`.`title`               AS `title`
FROM t_test a;

the script above is the best practive i have ever had... no problem with privilege issue like can not drop the temporary view table, etc

Notes :

I found inside the dump script database, that mysql treat the view object as table first then will be replaced by the real view.


You need to use SHOW CREATE VIEW statement.

SHOW CREATE VIEW v_sample
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜