To facilitate the use of code written for SQL implementations from other vendors, MySQL maps data
types as shown in the following table. These mappings make it easier to import table definitions from
other database systems into MySQL.
Other Vendor Type MySQL Type
BOOL TINYINT
BOOLEAN TINYINT
CHARACTER VARYING(M) VARCHAR(M)
FIXED DECIMAL
FLOAT4 FLOAT
FLOAT8 DOUBLE
INT1 TINYINT
INT2 SMALLINT
INT3 MEDIUMINT
INT4 INT
INT8 BIGINT
LONG VARBINARY MEDIUMBLOB
LONG VARCHAR MEDIUMTEXT
LONG MEDIUMTEXT
MIDDLEINT MEDIUMINT
NUMERIC DECIMAL
Data type mapping occurs at table creation time, after which the original type specifications are
discarded. If you create a table with types used by other vendors and then issue a DESCRIBE
tbl_name statement, MySQL reports the table structure using the equivalent MySQL types. For
example:
mysql> CREATE TABLE t (a BOOL, b FLOAT8, c LONG VARCHAR, d NUMERIC);
Query OK, 0 rows affected (0.00 sec)
mysql> DESCRIBE t;
+-------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+-------+
| a | tinyint(1) | YES | | NULL | |
| b | double | YES | | NULL | |
| c | mediumtext | YES | | NULL | |
| d | decimal(10,0) | YES | | NULL | |
+-------+---------------+------+-----+---------+-------+
4 rows in set (0.01 sec)
相关文章
- MYSQL数据库的常用数据类型
- 数据库: 安装配置数据库,使用Navicat for MySQL和手机APP 连接测试(如果上一节碰到问题可参考这一节)
- 与数据库datetime类型转换--Java数据类型与MySql类型对照表
- 数据加载与保存-通用方式 使用df.write.save方法保存数据,同样可通过format指定数据类型。 save方法后需传入保存路径(针对csv、orc、parquet、textFile格式)。 option方法用于设置特定格式的参数。 保存操作可使用SaveMode来指明如何处理数据,如覆盖(overwrite)、追加(append)等,通过mode方法设置。 特定格式保存 与加载类似,Parquet、JSON、CSV等格式均可通过指定format进行保存。 MySQL等关系型数据库的写入也通过JDBC实现,需指定format为jdbc,并传入数据库连接信息及表名。 注意事项
- 数据库服务概述,构建MYSQL服务器,数据库基本管理,mysql数据类型,表结构的调整
- mysql数据库参考文献2018_2018-4-25mysql数据库基础
- mysql 参考文献_后记&参考文献
- 论文关于mysql数据库文献_数据库论文参考文献
- MySQL架构优化实战系列1:数据类型与索引调优全解析
- Mysql数据类型---SET