MySQL数据类型
建表时使用的数据类型
生成的数据类型
备注
c_bigint
bigint
(-9,223,372,036,854,775,808,9 223 372 036 854 775 807)
c_bigint_unsigned
bigint unsigned
(0,18 446 744 073 709 551 615)
c_binary
binary(255)
c_bit
bit(64)
bit数据类型范围在1到64之间
c_blob
blob
65KB 0-65 535 bytes
c_bool
tinyint(1)
c_char
char(255)
0-255 bytes 定长字符串
c_date
date
3Bytes. 1000-01-01/9999-12-31
c_datetime
datetime
8Bytes. 1000-01-01 00:00:00/9999-12-31 23:59:59
c_decimal
decimal(10,0)
对DECIMAL(M,D) ,如果M>D,为M+2否则为D+2
c_double
double
8Bytes (-1.797 693 134 862 315 7 E+308,-2.225 073 858 507 201 4 E-308),0,(2.225 073 858 507 201 4 E-308,1.797 693 134 862 315 7 E+308)
c_double_precision
double
c_enum
enum('A','B','C','D')
枚举最大可以有 65535 个成员值,尾部空格自动删除
c_float
float
4Bytes (-3.402 823 466 E+38,-1.175 494 351 E-38),0,(1.175 494 351 E-38,3.402 823 466 351 E+38)
c_int
int
(-2 147 483 648,2 147 483 647)
c_int_unsigned
int unsigned
(0,4 294 967 295)
c_integer
int
(-2 147 483 648,2 147 483 647)
c_integer_unsigned
int unsigned
(0,4 294 967 295)
c_json
json
c_long_varbinary
mediumblob
c_long_varchar
mediumtext
c_longblob
longblob
4GB 0-4 294 967 295 bytes
c_longtext
longtext
0-4 294 967 295 bytes
c_mediumblob
mediumblob
16MB 0-16 777 215 bytes
c_mediumint
mediumint
3Bytes. (-8 388 608,8 388 607)
c_mediumint_unsigned
mediumint unsigned
(0,16 777 215)
c_mediumtext
mediumtext
0-16 777 215 bytes
c_numeric
decimal(10,0)
numeric 同decimal
c_real
double
real同double
c_set
set('Sa','Sb','Sc')
SET最多可以有64个不同的成员,尾部空格自动删除
c_smallint
smallint
(-32 768,32 767)
c_smallint_unsigned
smallint unsigned
c_text
text
0-65 535 bytes
c_time
time
3Bytes. '-838:59:59'/'838:59:59'
c_timestamp
timestamp
4Bytes 1970-01-01 00:00:00/2038 结束时间是第 2147483647 秒,北京时间 2038-1-19 11:14:07,格林尼治时间 2038年1月19日 凌晨 03:14:07255B
c_tinyblob
tinyblob
0-255 bytes
c_tinyint
tinyint
(-128,127)
c_tinyint_unsigned
tinyint unsigned
c_tinytext
tinytext
0-255 bytes
c_varbinary
varbinary(255)
c_varchar
varchar(255)
0-65535 bytes
c_year
year
1Byte 1901/2155
建表时使用的数据类型 | 生成的数据类型 | 备注 |
---|---|---|
c_bigint | bigint | (-9,223,372,036,854,775,808,9 223 372 036 854 775 807) |
c_bigint_unsigned | bigint unsigned | (0,18 446 744 073 709 551 615) |
c_binary | binary(255) | |
c_bit | bit(64) | bit数据类型范围在1到64之间 |
c_blob | blob | 65KB 0-65 535 bytes |
c_bool | tinyint(1) | |
c_char | char(255) | 0-255 bytes 定长字符串 |
c_date | date | 3Bytes. 1000-01-01/9999-12-31 |
c_datetime | datetime | 8Bytes. 1000-01-01 00:00:00/9999-12-31 23:59:59 |
c_decimal | decimal(10,0) | 对DECIMAL(M,D) ,如果M>D,为M+2否则为D+2 |
c_double | double | 8Bytes (-1.797 693 134 862 315 7 E+308,-2.225 073 858 507 201 4 E-308),0,(2.225 073 858 507 201 4 E-308,1.797 693 134 862 315 7 E+308) |
c_double_precision | double | |
c_enum | enum('A','B','C','D') | 枚举最大可以有 65535 个成员值,尾部空格自动删除 |
c_float | float | 4Bytes (-3.402 823 466 E+38,-1.175 494 351 E-38),0,(1.175 494 351 E-38,3.402 823 466 351 E+38) |
c_int | int | (-2 147 483 648,2 147 483 647) |
c_int_unsigned | int unsigned | (0,4 294 967 295) |
c_integer | int | (-2 147 483 648,2 147 483 647) |
c_integer_unsigned | int unsigned | (0,4 294 967 295) |
c_json | json | |
c_long_varbinary | mediumblob | |
c_long_varchar | mediumtext | |
c_longblob | longblob | 4GB 0-4 294 967 295 bytes |
c_longtext | longtext | 0-4 294 967 295 bytes |
c_mediumblob | mediumblob | 16MB 0-16 777 215 bytes |
c_mediumint | mediumint | 3Bytes. (-8 388 608,8 388 607) |
c_mediumint_unsigned | mediumint unsigned | (0,16 777 215) |
c_mediumtext | mediumtext | 0-16 777 215 bytes |
c_numeric | decimal(10,0) | numeric 同decimal |
c_real | double | real同double |
c_set | set('Sa','Sb','Sc') | SET最多可以有64个不同的成员,尾部空格自动删除 |
c_smallint | smallint | (-32 768,32 767) |
c_smallint_unsigned | smallint unsigned | |
c_text | text | 0-65 535 bytes |
c_time | time | 3Bytes. '-838:59:59'/'838:59:59' |
c_timestamp | timestamp | 4Bytes 1970-01-01 00:00:00/2038 结束时间是第 2147483647 秒,北京时间 2038-1-19 11:14:07,格林尼治时间 2038年1月19日 凌晨 03:14:07255B |
c_tinyblob | tinyblob | 0-255 bytes |
c_tinyint | tinyint | (-128,127) |
c_tinyint_unsigned | tinyint unsigned | |
c_tinytext | tinytext | 0-255 bytes |
c_varbinary | varbinary(255) | |
c_varchar | varchar(255) | 0-65535 bytes |
c_year | year | 1Byte 1901/2155 |
测试无符号浮点数
建表 | 生成 |
---|---|
c_double_unsigned | double unsigned |
c_float_unsigned | float unsigned |
c_numeric_unsigned | decimal(10,0) unsigned |
IDEA自动映射的数据类型
private Long cBigint;
private Object cBigintUnsigned;
private byte[] cBinary;
private Boolean cBit;
private byte[] cBlob;
private Byte cBool;
private String cChar;
private Date cDate;
private Timestamp cDatetime;
private Integer cDecimal;
private Double cDouble;
private Double cDoublePrecision;
private Object cEnum;
private Double cFloat;
private Integer cInt;
private Object cIntUnsigned;
private Integer cInteger;
private Object cIntegerUnsigned;
private byte[] cLongVarbinary;
private String cLongVarchar;
private byte[] cLongblob;
private String cLongtext;
private byte[] cMediumblob;
private Object cMediumint;
private Object cMediumintUnsigned;
private String cMediumtext;
private Integer cNumeric;
private Double cReal;
private Object cSet;
private Short cSmallint;
private Object cSmallintUnsigned;
private String cText;
private Time cTime;
private Timestamp cTimestamp;
private byte[] cTinyblob;
private Byte cTinyint;
private Object cTinyintUnsigned;
private Object cTinytext;
private byte[] cVarbinary;
private String cVarchar;
private Object cYear;
private Object cJson;
private Object cDoubleUnsigned;
private Object cFloatUnsigned;
private Integer cNumericUnsigned;