1

我可以合并 SELECT 查询和 SHOW 语句的结果吗?

例如 - 需要在一张表中得到答案:

 select * from INFORMATION_SCHEMA.VIEWS

 show create view `v1`

谢谢!

4

1 回答 1

1

不,你不能。但是下面的查询会给出类似的结果:

SELECT *, CONCAT(
 "CREATE",
 -- can't get ALGORITHM
 " DEFINER = '",
   SUBSTRING_INDEX(DEFINER, '@', 1), "'@'", SUBSTRING_INDEX(DEFINER, '@', -1), "'",
 " SQL SECURITY ", SECURITY_TYPE,
 " VIEW `", REPLACE(TABLE_NAME, "`", "``"), "`",
 " AS ", VIEW_DEFINITION,
 IF(CHECK_OPTION <> "NONE", CONCAT(" WITH ", CHECK_OPTION, " CHECK OPTION"), "")
) AS `CREATE`
FROM INFORMATION_SCHEMA.VIEWS
于 2012-07-02T08:39:26.210 回答