MySQL使用Union创建视图报错
mysql>
select
*
from
test_main;
+
----+-------+
| id | value |
+
----+-------+
| 1 | ONE |
| 2 | TWO |
| 3 | THREE |
+
----+-------+
3
rows
in
set
(0.00 sec)
mysql>
create
table
test_main2
select
*
from
test_main;
Query OK, 3
rows
affected (0.04 sec)
Records: 3 Duplicates: 0 Warnings: 0
-- 创建视图, sql 语句加了括号, 报错。
CREATE
VIEW
view_test_main
AS
(
SELECT
*
FROM
test_main
UNION
ALL
SELECT
*
FROM
test_main2
);
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
'UNION
ALL
SELECT * FROM test_main2
)'
at
line 5
-- 创建视图, sql 语句不加括号, 通过。
mysql>
CREATE
VIEW
view_test_main
->
AS
->
SELECT
*
FROM
test_main
->
UNION
ALL
->
SELECT
*
FROM
test_main2;
Query OK, 0
rows
affected (0.01 sec)
MySQL使用Union创建视图报错的更多相关文章
- mysql 5.7 创建函数报错,This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creat
今天用命令创建函数, 报错 This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration ...
- mysql 5.7 创建用户报错ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
如: INSERT INTO user (host, user, authentication_string, select_priv, insert_priv, update_priv) VALUE ...
- hibernate调用mysql自己手动创建函数报错
split为自己手动在mysql中创建的函数,在hibernate调用时出错,解决方案如下: jdbc调用可以.不用改hibernate的方言. 正常的为:
- Mysql备份迁移——MySqlBackup(.net)——(无法解决视图嵌视图报错)
这里是利用MySqlBackup,可以再nuget中下载. 无法解决视图嵌视图报错的问题,只导表跟数据比较合适,如果有视图嵌视图,请参照Mysql备份迁移——Mysqldump(.NET调用Mysql ...
- Oracle中建立物化视图报错
Oracle中建立物化视图报错 今天在建立视图的时候,报了一个错:ORA-01723: zero-length columns are not allowed. 建视图的语句: create mate ...
- MySQL 表与字段编码格式报错
MySQL 表与字段编码格式报错 一.数据库,表,字段编码格式都为latin1(iso-8859-1) .当数据保存到数据库后,中文显示乱码. 解决办法: 1.在访问数据库连接串中添加编码格式: &l ...
- 在给mysql数据库备份时,报错: mysqldump: Got error: 145: Table '.\shengdaxcom\pre_forum_thread' is marked as c rashed and should be repaired when using LOCK TABLES
在给mysql数据库备份时,报错: mysqldump: Got error: 145: Table '.\shengdaxcom\pre_forum_thread' is marked as cra ...
- idea创建类报错
创建类报错: 在idea.exe.vmoptions 或 idea64.exe.vmoptions中加入配置 -Djdk.util.zip.ensureTrailingSlash=false jar包 ...
- egg 连接 mysql 的 docker 容器,报错:Client does not support authentication protocol requested by server; consider upgrading MySQL client
egg 连接 mysql 的 docker 容器,报错:Client does not support authentication protocol requested by server; con ...
随机推荐
- JS中onpropertychange和onchange事件区别小结
当一个HTML元素的属性用js改变的时候,都能通过onpropertychange来捕获.例如一个文本text对象的value属性被页面的脚本修改的时候,onchange无法捕获到,而onproper ...
- 160. Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins. For ex ...
- hadoop删除节点
1.修改Master节点Hdfs-site.xml,增加dfs.hosts.exclude参数 eg: <property> <name>dfs.hosts.exclude&l ...
- 多线程问题(JVM重排序)
public class Test3 { private static boolean ready; private static int Number; private static class R ...
- Apache安全配置
vi /etc/httpd/conf/httpd.conf #编辑文件 ServerTokens OS 在44行修改为:ServerTokens Prod (在出现错误页的时候不显示服务器操作系统的 ...
- Python学习(3)——if语句
虽然在之前接触过C.C++.Java等,但是还是觉得Python写出来的好看o(≧v≦)o~,简洁明了! score = raw_input("score:") score=int ...
- JS 排序算法
冒泡排序: 核心思想:从第一个开始遍历数组,遍历完成后,让最小的值放在第一位:然后从第二个开始遍历数组,遍历完成后将最小值放在第二位:以此类推,所有位的数组遍历完成后就排序完成. var arr = ...
- SpringMVC给外部资源加版本号避免缓存
一.属性文件:version.properties ->内容:version=201608 二.java代码 public class configVersion implements Ser ...
- Linux comands
https://www.mankier.com/8/vmstat http://docs.oracle.com/cd/E23824_01/html/821-1451/spmonitor-22.html ...
- breakpoints
https://blogs.msdn.microsoft.com/visualstudioalm/2013/10/07/breakpoints-in-visual-studio-2013/ Using ...