之前一直使用oracle,将oracle中自己建的表移至mysql中。做如下记录:
oracle | mysql | |
字符串 | varchar2 | varchar |
字段注释 | 建表SQL后,使用:comment on column 表名.字段名 is '注释'; | 创建表时,直接字段后添加:字段名 VARCHAR(20) comment '注释' |
数字类型 | 可以使用number | 使用int、float |
建表 | 字段命名方面没有什么特殊的 | 字段名直接使用关键字,建表报错,例如[ERR] 1064 |
创建表时报错:
[ERR] 1064 - 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 'describe VARCHAR(60)' at line 9
解决:describe字段在mysql中属于关键字,可以换个名字,或者表示为`describe`。【`】这个符号是键盘上【~】下面的符号。
数据从oracle到mysql:
看了一篇比较全面的文章,里面有详细步骤 https://blog.csdn.net/qq_41889087/article/details/80353632