一、字段转化对照表

源MYSQL字段类型 加载目标库SYBASE字段类型 是否支持
int int 是
tinyint int 是
smallint int 是
mediumint int 是
bigint bigint 是
float float 是
declmal(m,d)或numeric(m,d) decimal 是
double或real float 是
char char 是
varchar varchar 是
tinytext text 是
text text 是
mediumtext text 是
longtext text 是
date date 是
time time 是
datetime datetime 是
timestamp datetime 是
year int 是
tinyblob image 是
blob image 是
mediumblob image 是
longblob image 是
bit varbinary 是
binary varbinary 是
enum int 是
set int 是

二、DDL语句支持列表

语句类型 语句概要 SQL MYSQL-SYBASE是否支持
创建表 建表带索引及外键 create table mysql_tab6(test_1 int primary key comment 'this is a test tab',test_ind bigint,test_3 tinyint,index ind_test_ind(test_ind),constraint fk_tab6_test_3 foreign key(test_3) references mysql_tab1(test_2)); 是,不建外键约束
数值型 create table mysql_tab1(test_1 int primary key,test_2 tinyint,test_3 smallint default 10 not null,test_4 mediumint,test_5 bigint,test_6 float,test_7 decimal(38,10),test_8 double,unique key(test_2)); 是
字符型 create table mysql_tab2(test_1 int primary key,test_2 char(255),test_3 varchar(2000),test_4 tinytext,test_5 text,test_6 mediumtext,test_7 longtext); 是
日期型 create table mysql_tab3(test_1 int primary key,test_2 date,test_3 time,test_4 datetime,test_5 timestamp,test_6 year); 是
lob及二进制 create table mysql_tab4(test_1 int primary key,test_2 blob,test_3 tinyblob,test_4 mediumblob,test_5 longblob,test_6 binary,test_7 varbinary(10)); 是
表名大写+不常用类型 create table MYSQL_TAB5(Test_1 int primary key,Test_2 enum('a','b'),Test_3 set('a1','b1','c1')); 是
添加列 特殊字段 alter table mysql_tab4 add test_7 bit; 是
特殊字段 alter table mysql_tab6 add test_2 longblob; 是
含字段长度 alter table mysql_tab6 add test_11 varchar(200); 是
特殊字段+字段长度 alter table mysql_tab6 add test_4 varbinary(10); 是
设为null alter table mysql_tab6 add test_5 tinyint null; 是
设为not null alter table mysql_tab6 add test_6 smallint not null; 是
not null + default alter table mysql_tab6 add test_7 bigint not null default 10; 是
default alter table mysql_tab6 add test_8 char(255) default 'asd1'; 是
添加多列 alter table mysql_tab6 add (test_9 varchar(4000),test_10 tinytext); 是
修改列属性 含字段长度 alter table mysql_tab6 modify test_3 varchar(1000); 是
设为null alter table mysql_tab6 modify test_4 varbinary(11) null; 是
defalut alter table mysql_tab6 modify test_5 mediumint default 100; 是
not null + default alter table mysql_tab6 modify test_6 bigint not null default 101; 是
更改列名+属性 alter table mysql_tab6 change test_10 test_12 text; 是
更改列名+ default alter table mysql_tab6 change test_9 test_13 varchar(300) default '10011' not null; 是
defalut alter table mysql_tab6 alter test_11 set default 'asb123'; 是
删除default alter table mysql_tab6 alter test_7 drop default; 是
重命名表 更改表名 alter table mysql_tab5 rename to mysql_tab7; 是
添加、删除索引 创建普通索引 create index ind_test_6 on mysql_tab6(test_6); 是
创建普通索引 alter table mysql_tab6 add index ind_test_5(test_5); 是
删除普通索引 drop index ind_test_ind on mysql_tab6; 是
删除普通索引 alter table mysql_tab6 drop index ind_test_6; 是
删除普通索引 alter table mysql_tab6 drop index ind_test_5; 是
创建唯一索引 alter table mysql_tab6 add unique index uk_ind_test_ind(test_ind); 是
删除唯一索引 alter table mysql_tab6 drop index uk_ind_test_ind; 是
删除主键 alter table mysql_tab6 drop primary key; 是
添加主键 alter table mysql_tab6 add primary key(test_1); 是
添加注释 列注释 alter table mysql_tab6 modify test_7 bigint comment 'this is a int filed'; 是
表注释 alter table mysql_tab6 comment 'this is a test mysql table'; 是
删除列 删除列 alter table mysql_tab6 drop column test_12; 是
表名、列名大小写 列名大写 alter table MYSQL_TAB5 add TEST_4 INT first,add Test_5 tinyint not null default 2 after `Test_1`,add (test_6 varchar(20),test_7 double); 是
含字段度 ALTER TABLE MYSQL_TAB5 MODIFY Test_2 varchar(20); 是
default alter table MYSQL_TAB5 change Test_3 test_5 set('a1','b1','c1') default 'a1'; 是
删除default alter table MYSQL_TAB5 alter Test_5 drop default; 是
创建索引 create index ind_tab5 on MYSQL_TAB5(TEST_4); 是
删除索引 ALTER TABLE MYSQL_TAB5 DROP INDEX ind_tab5; 是
列注释 alter table MYSQL_TAB5 MODIFY TEST_4 INT comment 'this is a test_4'; 是
表注释 alter table MYSQL_TAB5 comment 'THIS IS A TEST TAB5'; 是
文档更新时间: 2021-11-11 21:25   作者:操李红