
定义,修改,视图时候别忘记as select中的as
发布日期:2021-05-07 00:53:33
浏览次数:25
分类:原创文章
本文共 1138 字,大约阅读时间需要 3 分钟。
mysql> show create view view_2\G*************************** 1. row *************************** View: view_2 Create View: CREATE ALGORITHM=MERGE DEFINER=`skip-grants user`@`skip-grants host` SQL SECURITY DEFINER VIEW `view_2` (`a`,`b`,`c`) AS select `student`.`id` AS `id`,`student`.`name_stu` AS `name_stu`,`student`.`address` AS `address` from `student` WITH CASCADED CHECK OPTIONcharacter_set_client: utf8mb4collation_connection: utf8mb4_0900_ai_ci1 row in set (0.00 sec)
使用alter语句修改视图,执行如下代码,结果出错
mysql> alter algorithm = undefined view view_2(aa,bb,cc) select student.id,student.name_stu,student.address from student with local check option;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select student.id,student.name_stu,student.address from student with local ch' at line 1
自习查找错误,发现少加了一个as,正确代码如下:
mysql> alter algorithm = undefined view view_2(aa,bb,cc) as select id,name_stu,address from student with local check option;Query OK, 0 rows affected (0.01 sec)
总结:定义,修改,视图时候别忘记as select中的as
发表评论
最新留言
感谢大佬
[***.8.128.20]2025年04月02日 00时14分08秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
spring启动错误:Could not resolve placeholder
2021-05-08
日志写入xml上传ftp遇到的问题
2021-05-08
下载任意版本vmware对应的vmware tools
2021-05-08
将 github 中他人的 仓库 导入 码云中,从而 加快下载速度的 方式
2021-05-08
Java 类加载的过程 加载、验证、准备、解析、初始化
2021-05-08
JavaWeb---实现JavaBean来接收参数、请求转发、域对象
2021-05-08
瀚高数据库中 java代码类型与bit对应(APP)
2021-05-08
选择性估算器绕过行安全策略漏洞
2021-05-08
PostgreSQL中的触发器
2021-05-08
对PostgreSQL数据库结构的宏观理解
2021-05-08
Postgresql 日期和时间类型
2021-05-08
xmin、xmax、cmin、cmax
2021-05-08
查询某表格上次进行vacuum的时间
2021-05-08
invalid byte sequence for encoding
2021-05-08
Highgo Database故障收集脚本
2021-05-08
failed to initialize the database
2021-05-08
invalid byte sequence for encoding
2021-05-08
银河麒麟系统配置apt网络源
2021-05-08
第七周 4.12-4.18
2021-05-08
程序设计入门14 结构体
2021-05-08