mysql常用命令,mysql数据类型和Java数据类型对应

一、创建数据库
1.dos命令打开数据库
mysql -u root -pok

2.查看数据库
show databases;

3.创建数据库(假设数据库表名abc)
create database abc;

4.删除数据库
drop database abc;

5.创建数据库(如果该表不存在)
create database if not exists abc;

6.使用指定的某个数据库
use abc;

7.查看上述指定数据库下的表
show tables;

二、表的语法
2.1.1.创建数据库表
create table user_inf
(
    user_id int primary key auto_increment,/*primary key 设置主键,auto_increment自动增长*/
    user_name varchar(255)
)

2.1.2.查看表的信息
desc user_info;

2.1.3.为user_inf表添加一个字段age,该字段的类型是int
alter table user_inf add age int;

2.1.4.为user_inf表再新增2个varchar(255)的列
alter table user_inf add
(
    address varchar(255) default 'suzhou',
    hobby varchar(255)
)

2.1.5.将user_inf表中的hobby列的类型由varchar改成int
alter table user_inf modify hobby int;

2.1.6.将user_inf中的age类型由int修改为varchar(10)
alter table user_inf modify age varchar(10);

2.1.7.删除某一列
alter table user_inf drop hobby;

2.1.8.修改表user_inf的名称为student_info(表名的重命名)
alter table user_inf rename student_info;

2.1.9.清楚表中所有的数据,但不删除表
truncate student_info;

2.1.10.删除表student_info(删除整个表,包括主键等)
drop student_info;

######################列类型#########################
3.1.1.创建一个表person,使用tinyint列类型
create table person(
    id int primary key auto_increment,
    name varchar(255),
    age tinyint
) cahrset = utf8;

3.1.2.插入数据
insert into person (name,age) values ('小王','20');
insert into person (name,age) values ('老王','200');/*不报错,但插入数据为127*/
insert into person (name,age) values ('小刘','127');/*tinyint的最大值*/

3.1.3.查看表中的所有数据
select * from person;

3.1.4.给person添加一列
alter table person add age2 tinyint(5) zerofill;

3.1.5.添加纪录
insert into person (name,age2) values ('小王','5');

3.1.6.设置列不为空,指定默认值
alter table person add age3 tinyint(3) not null default 0000;

######小数型/浮点型、定点型#########
4.1.1.创建fruit表,属性名字,价格(两位小数)
create table fruit(
    name varchar(10) not null default '',
    price float(6,2) not null default 0.00
)

4.1.2.添加纪录
insert into fruit (name,price) values ('apple','24.22');

4.1.3.使用decimal添加一列
alter table fruit add bigprice decimal(9,2) not null default 0.00;

4.1.5.插入数据
insert into fruit (name,bigprice) values('pear','124134.2123');

########日期类型######
5.1.2.创建含有日期类型存储表y
create table y
(
    ya year(4)/*只显示年份1900-2055,可以两位:[00-69]表示2000~2069年,[70-99]表示1970~1999年*/
)

5.1.3.插入记录
insert into y(ya) values ('2019');
insert into y values ('88');
insert into y values ('01');

######date类型#########
5.2.1.创建含有date类型的表gs401/*'1000-01-01'~'9999-01-01'*/
create table GS401
(
    title varchar(30),
    dt date
)

5.2.2.插入记录
insert into gs401 values ('java开班时间','2018-12-03');

#######time类型######
5.3.1.创建含有time类型的表course
create table course
(
    name varchar(30),
    start_time time
)

5.3.2.插入记录
insert into course values ('MySql','8:30:00');/*会自动补全'08:30:00'*/

#########datetime类型########
5.4.1.创建含有datetime类型属性的表notice
create table notice
(
    title varchar(30),
    publish_time datetime not null default '1000-0-0 00:00:00'
)

5.4.2.插入记录
insert into notice values ('放假时间','2019-01-26 16:50:00');

#####定义列表示性别#####
6.1.1.定义列表示性别的表users/*一般用0表示女,1表示男*/
create table users
(
    name varchar(20),
    gender tinyint(1)
)

6.1.2.插入记录
insert into users values ('小红','0');
insert into users values ('小明','1');


#########################约束条件#############################
################非空约束################
7.1.1.建立含有非空约束的表hehe
create table hehe
(
    hehe_id int not null,
    hehe_name varchar(255) default 'xyz' not null,
    hehe_gender varchar(2) null
)

7.1.2.建表后添加约束(将hehe_gender设置为非空)
alter table hehe modify hehe_gender varchar(2) not null;

7.1.3.删除某一个约束(删除hehe_name中非空约束,即设置hehe_name为可以为空)
alter table hehe modify hehe_name varchar(20) null;

7.1.4.删除某一个约束,并添加默认值(删除hehe_name非空约束,并设置默认值xxx)
alter table hehe modify hehe_name varchar(20) null default 'xxx';

7.1.5.添加数据
/*错误示例一:insert into hehe values ('jack','0');*/
/*错误示例二:insert into hehe(hehe_name,hehe_gender) values ('jack','0');*/
insert into hehe values('1','javk','1');

#################unique唯一约束##############
###注意:唯一,但可以有多个null
7.2.1.使用列级语法创建唯一约束表tree,指定name列唯一约束
create table tree
(
    tree_id int not null,
    tree_name varchar(255) unique
)

7.2.2.插入记录
insert into tree values ('1','银杏树');
/*插入失败,name唯一约束,与上一条name重复,无法插入 insert into tree values ('2','银杏树');*/

7.2.3.使用表级语法指定唯一约束
create table exam
(
    exam_id int not null,
    exam_name varchar(20),
    exam_pass varchar(20),
    /*使用表级语法定义exam_name为唯一约束*/
    unique(exam_name)
)
/*创建后删除*/
drop table exam;

7.2.4.新增唯一约束(例如exam_name,exam_pass唯一约束,只要定义的多个唯一中有一个不满足唯一就报错,无法插入)
create table exam
(
    exam_id int not null,
    exam_name varchar(20),
    exam_pass varchar(20),
    /*使用表级语法定义exam_name为唯一约束*/
    unique(exam_name),
    /*再指定exam_pass也是唯一约束,且可以指定约束名称(例如约束名称为exam_pass_uk)*/
    constraint exam_pass_uk unique(exam_pass)
)

7.2.5.插入数据
insert into exam values ('1','语文','90');
insert into exam values ('2','数学','80');/*可以插入*/
/*insert into exam values ('3','语文','90');不可以插入,语文,90重复*/
/*insert into exam values ('4','数学','90');不可以插入,90重复*/
/*insert into exam values ('5','语文','80');不可以插入,语文重复*/

7.2.6.查看表exam的详细结构
show create table exam;

7.2.7.创建组合约束
create table student
(
    s_id int not null,
    s_name varchar(20),
    s_pid varchar(20),
    #使用表级语法创建多列唯一约束,s_name和s_pid只有组合不允许重复
    constraint student_uk unique(s_name,s_pid)
)

7.2.8.插入数据
insert into student values ('1','jack','321343199701011234');
insert into student values ('2','jack','321343199701011111');/*可以插入,s_pid不一致*/
/*insert into student values ('3','jack','321343199701011234');无法插入,s_name和s_pid与第一个重复*/
insert into student values ('4','tom','321343199701011234');/*可以插入,s_name不一致*/

7.2.9.删除约束
#移除student表中的student_uk约束
alter table student drop index student_uk;

7.2.10.添加唯一约束(将上述组合约束设置回来)
alter table student add unique(s_name,s_pid);

7.2.11.使用modify关键字添加约束
alter table student modify s_pid varchar(20) unique;

#################主键约束#####################
7.3.1.创建teacher设置t_id为主键
create table teacher
(
    #使用列级语法定义主键
    t_id int primary key,
    t_name varchar(20)
)

7.3.2.添加纪录
insert into teacher values ('1','jack');
/*insert into teacher values ('1','tom');无法插入,主键唯一*/

7.3.3.创建表school,使用表级语法定义主键s_id
create table school
(
    s_id int not null,
    s_name varchar(20),
    s_addr varchar(20),
    #使用表级语法定义主键
    #指定主键,对于mysql数据,无法指定主键名称,依然是PRIMARY
    constraint id_pk primary key(s_id)
)

7.3.4.创建表classroom,设置c_name和c_loc为联合主键
#注意:联合主键只能使用表级语法定义
create table classroom
(
    c_name varchar(20),
    c_loc varchar(20),
    #使用表级语法,创建联合主键
    primary key(c_name,c_loc)
)

7.3.5.插入数据
insert into classroom values ('A01','三楼');
insert into classroom values ('A02','三楼');
insert into classroom values ('A01','二楼');
/*insert into classroom values ('A01','三楼');无法插入*/

7.3.6.删除已定义的主键
alter table classroom drop primary key;

7.3.7.新增主键
#使用表级语法创建主键
alter table classroom add primary key(c_name,c_loc);

7.3.8.使用modify对某一列指定主键
alter table classroom modify c_name varchar(20) primary key;

7.3.9.###创建student表,设置主键s_id自动增长
create table student
(
    s_id int auto_increment primary key,
    s_name varchar(20),
    s_score int 
)

7.3.10.添加纪录
insert into student(s_name,s_score) values('jack','99');
insert into student(s_name,s_score) values('tom','90');
insert into student(s_name,s_score) values('lily','89');

#################外键约束###################
##为保证数据的一致性,一般先创建主表
7.4.1.创建teacher表
create table teacher 
(
    #指定id主键,设置自动增长
    teacher_id int auto_increment primary key,
    teacher_name varchar(20)
)

7.4.2.创建从表student
create table student
(
    student_id int auto_increment primary key,
    student_name varchar(20),
    -- 绑定学生的老师
    -- 使用外键约束,使用references指定参考某张表
    java_teacher int,
    foreign key (java_teacher) references teacher(teacher_id)
)

7.4.3.插入数据
insert into teacher(teacher_name) values ('tony');
insert into student(student_name,java_teacher) values('小明','1');
/*insert into student(student_name,java_teacher) values('小明','2'); 无法插入,因为teacher主表中没有teacher_id为2的信息*/

7.4.5.使用constraint指定外间的别名
create table teacher2 
(
    #指定id主键,设置自动增长
    teacher_id int auto_increment primary key,
    teacher_name varchar(20)
)
create table student2
(
    student_id int auto_increment primary key,
    student_name varchar(20),
    -- 绑定学生的老师
    -- 使用外键约束,使用references指定参考某张表
    java_teacher int,
    constraint student_teacher_fk foreign key (java_teacher) references teacher2(teacher_id)
)

7.4.6.组合主键对应外键
create table teacher3
(
    teacher_name varchar(20),
    teacher_no varchar(20),
    #使用表级语法设置组合主键
    primary key(teacher_name,teacher_no)
)
create table student3
(
    student_id int auto_increment primary key,
    student_name varchar(20),
    -- 绑定学生的老师
    -- 使用外键约束,使用references指定参考某张表
    java_teacher_name varchar(20),
    java_teacher_no varchar(20),
    foreign key (java_teacher_name,java_teacher_no) 
    references teacher3(teacher_name,teacher_no)
)

7.4.7.删除外键约束(student3_ibfk_1为show create table student3 查看的外键名)
alter table student3 drop foreign key student3_ibfk_1;

7.4.8.添加外键约束
alter table student3 add foreign key (java_teacher_name,java_teacher_no) 
    references teacher3(teacher_name,teacher_no)

7.5.级联删除
7.5.1.创建主表teacher4
create table teacher4 
(
    #指定id主键,设置自动增长
    teacher_id int auto_increment primary key,
    teacher_name varchar(20)
)

7.5.2.创建从表student4
create table student4
(
    student_id int auto_increment primary key,
    student_name varchar(20),
    -- 绑定学生的老师
    -- 使用外键约束,使用references指定参考某张表
    java_teacher int,
    foreign key (java_teacher) references teacher4(teacher_id) on delete cascade
)

7.5.3.插入数据
insert into teacher4 (teacher_name) values ('tony');
insert into student4 (student_name, java_teacher) values ('小明','1');

7.5.4.删除student4
drop table student4;

7.6.on delete set null:主表删除,从表外键设为null
7.6.1.创建表student4
create table student4
(
    student_id int auto_increment primary key,
    student_name varchar(20),
    #绑定学生的老师
    #使用外键约束,使用references指定参考某张表
    java_teacher int,
    foreign key(java_teacher) references teacher4(teacher_id) on delete set null
)

7.6.2.插入记录
insert into teacher4 (teacher_name) values ('tony');
insert into student4 (student_name, java_teacher) values ('小明','2');

7.6.3.删除teacher4表中的记录
delete from teacher4;

##################################索引##############################
8.1.1.对student4中创建索引
create index stu_name on student4(student_name);

8.1.2.为某张表的多列创建组合索引
create table employee
(
    id int auto_increment primary key,
    first_name varchar(20),
    last_name varchar(20)
)
create index emp_name_idx on employee(first_name,last_name);

8.1.3.删除索引
drop index emp_name_idx on employee;

################################视图#################################
9.1.1对于teacher表创建一个视图名为teacher_view
create or replace view teacher_view as select teacher_name from teacher;

create or replace view employee_view as select first_name,last_name from employee;
insert into employee (first_name,last_name) values ('li','bluce');

#注意设置视图对于原数据的保护
create or replace view employee_view as select first_name,last_name from employee with check option;

9.1.2.查看该视图
select * from teacher_view;
select * from employee_view;

###############################插入数据insert into########################################
在上述teacher中插入数据
insert into teacher (teacher_naem) values('zhuli');
#注意1:若某列的值不确定,这是用null为其指定
insert into teacher values (null,'jim');
#注意2:向含有外键的表中插入记录,则要外键的值必须已经存在

#同时插入多条记录,多值之间用逗号隔开
insert into teacher values (null,'david'),(null,'李老师');

###############修改记录update################
1.没有条件下全局修改
update teacher set teacher_name ='苏老师';
2.where条件
update teacher set teacher_name= 'jim' where teacher_id>3;

######################删除记录#########################
delete from student;
delete from student where student_id ='5';

####################################查询#####################################
#查询只是展示效果,不会对数据库中元数据做修改
create table teacher 
(
    #指定id主键,设置自动增长
    teacher_id int auto_increment primary key,
    teacher_name varchar(20)
)
create table student
(
    student_id int auto_increment primary key,
    student_name varchar(20),
    -- 绑定学生的老师
    -- 使用外键约束,使用references指定参考某张表
    java_teacher int,
    foreign key (java_teacher) references teacher(teacher_id)
)
insert into teacher values(null,'张老师');
insert into teacher values(null,'李老师');
insert into teacher values(null,'王老师');
insert into teacher values(null,'赵老师');
insert into teacher values(null,'tony');
insert into teacher values(null,'tony1');
insert into teacher values(null,'tony2');
insert into teacher values(null,'tony3');
insert into teacher values(null,'tony4');
insert into teacher values(null,'tony5');
insert into teacher values(null,'tony6');

insert into student values (null,'小红','3');
insert into student values (null,'小王','4');
insert into student values (null,'小明','8');
insert into student values (null,'小红','8');
insert into student values (null,'小花','9');
insert into student values (null,'jim','3');
insert into student values (null,'tom','5');
insert into student values (null,'jack','8');
insert into student values (null,'lily','1');
insert into student values (null,'jhon','10');
insert into student values (null,'王小龙','4');
insert into student values (null,'李小龙','11');
insert into student values (null,'_tom','5');
insert into student values (null,'_jack','8');
insert into student values (null,null,'10');
insert into student values (null,null,'5');
insert into student values (null,null,'8');


###############单表查询################
1.单表查询(以teacher表为例)
select * from teacher;

2.查询指定列(查询列会提高查询的效率,多列之间使用逗号隔开)
select teacher_id,teacher_name from teacher;
select teacher_name from teacher;

3.使用where关键字查询(根据id查询指定的列)
select * from teacher where teacher_id = 3;

4.将teacher_id的值+5后形成表达式返回
select teacher_id+5 from teacher ;

5.将表达式放置于where条件中
将teacher_id*3还大于15查询出
select * from teacher where teacher_id*3>15;

6.select后的数据使用表达式、变量、常量等
select 10+20,100,20 from teacher;

7.使用concat函数拼接查询出的数据列(例如在teacher_name之后拼接字符串-gem)
select concat(teacher_name,'-gem') from teacher;

8.使用as关键字指定查询出列的别名
select concat(teacher_name,'-gem') as new_teacher_name from teacher;

9.在定义别名中含有单引号,则使用双引号包裹
select concat(teacher_name,'-gem') as "teacher'name" from teacher;

10.查询的出的列含有多个别名,直接使用逗号分开
select teacher_id+1 as 教师编号 ,teacher_name 教师名 from teacher;

11.为表取别名,在查询的select之后添加[表别名.列名],查询出当前表的列
select t.teacher_id+1 as 教师编号,t.teacher_name 教师名 from teacher t;

12.concat函数可以将不同列当表达式处理
select t.teacher_id+1 as 教师编号,t.teacher_name 教师名 ,
concat(teacher_id,teacher_name) 教师昵称 from teacher t;

13where之后的条件为永真,为满足拼接多条件查询第一个查询条件
select 10+10 from teacher where 5<10;#有多少条记录执行多少次
#或者写成
select 10+10 from teacher where 1=1;

14.非sql标准语法,内置一个虚拟表,仅仅为了执行表达式
select 100*100;/*结果为10000*/
#在orical数据库中,应写为
select 100*100 from daul;

15.distinct去除展示重复记录(主键不一致无关)
select distinct teacher_name from teacher;

16.查询出id是6-9的范围,between关键字
select * from teacher where teacher_id between 6 and 9;

17.使用in查询出id为10,3,7三条记录,查询出teacher_name为tony,张老师的数据
select * from teacher where teacher_id in(10,3,7);
select * from teacher where teacher_name in('tony','张老师');

18.查询出java_teacher和student_id为8的记录
select * from student where 8 in (student_id,java_teacher);

19.18.查询出java_teacher小于等于8,student_id大于等于8的记录
select * from student where 8 between java_teacher and student_id;

20.查询出student以'小'开头
select * from student where student_name like '小%';

21.查询姓名只有2个字的学生信息(单个下划线表示一个字符)
select * from student where student_name like '__';

22.查找学生以_开头,对于含有特殊符号需要用\进行转义,预留_字符
#错误语句,展示全部信息
select * from student where student_name like '_%';
#正确语法
select * from student where student_name like '\_%';

23.查询出学生姓名是null的记录
select * from student where student_name is null;

24.查询出学生姓名是2个字,且student_id小于3的记录
select * from student where student_name like '__' and student_id<3;

25.or关键字,学生的id大于7或者学生的姓名以"小"开头,且java_teacher小于5的记录
select * from student where (student_id>7 or student_name like '小%')
and java_teacher<5;

26.使用not对where取反,查出所有学生不是_开头的名称记录
select * from student where not student_name like '\_%';

#########排序问题##########
1.默认升序排列
select * from student order by java_teacher;

2.asc升序(由小到大),desc降序(由大到小)
select * from student order by java_teacher desc;

3.多列同时排序,多列之间使用逗号隔开(例如老师id降序排序,学生的id升序)
select * from student order by java_teacher desc,student_id asc;

#########################数据库函数############################
#查询出教师的姓名,并获取每个名称的长度
select teacher_name as 教师姓名 , char_length(teacher_name) 名称长度 from teacher;

#三角函数相关,sin值
select teacher_name as 教师姓名 ,char_length(teacher_name) 名称长度, sin(CHAR_LENGTH(teacher_name)) sin值 from teacher;

#使用sin函数计算某一个固定值
select sin(1.5);

#日期函数
#在某个时间点添加一段时间
#2019——1——17基础上添加3个月,interval,指定单位
select date_add('2019-1-17',interval 3 month);
#更简洁写法,adddate添加指定的天数,无法设置单位
select adddate('2019-1-17',3);

#获取当前日期
select curdate();
select CURRENT_DATE();
#获取当前时间
select CURRENT_TIME();
获取当前日期时间
select now();
select cURRENT_TIMESTAMP();

#对用户的密码进行加密
select md5('123456');

#如果学生的姓名是null,返回'姓名未设置'
select student_name 原姓名, ifnull(student_name,'姓名未设置')  姓名列 from student;

#如果列的值为'张三',则返回null
select student_name 原姓名, nullif(student_name,'小红') 修改后 from student;

#如果学生的姓名为null,则提示‘名称未设置’,反之‘名称已设置’
#if(expr1,expr2,expr3),若expr1为真,不等于null且不等于0,运行expr2,反之运行expr3
select student_name 原姓名, if(isnull(student_name),'名称未设置','名称已设置') 处理后 from student;

#如果java_teacher值是4,则返回‘java老师’,如果是8,返回‘高级java老师’,其他返回‘特级java老师’
select student_name ,java_teacher,case java_teacher
when 4 then 'java老师'
when 8 then '高级java老师'
else '特级老师'
end
from student ;

#判断学生的id,如果是小于5,返回‘小班’,小于10,返回‘中班’,大于10,返回‘大班’
select student_id,student_name, case
when student_id<5 then '小班'
when (student_id>=5 and student_id<10 ) then '中班'
else '大班'
end
from student;

#########分组和组函数#########
#计算teacher表中的记录数
select count(*) 记录总数 from teacher;
select count(1) 记录总数 from teacher;#效率高

#计算student表中java_teacher列的值
select count(java_teacher) from student;#结果12
#取出重复值
select count(distinct java_teacher) from student;#结果8
#使用count指定某一个列,计算记录总数,对于null不做计算
select count(student_name) from student;#14

#统计学生表中所有id的总和
select sum(student_id) id总和 from student;
#计算出student表中id最大的值
select max(student_id) from student; 
#计算出student表中id最小的值
select min(student_id) from student; 

#计算平均值
#计算student表中java_teacher列的平均值
#若java_teacher中有null值,如何处理
#可以使用ifnull
select truncate(avg(ifnull(java_teacher,0)),2) from student;
#注意:对于distinct和*不能同时出现

##count(*)对每一个分组查询,得到一个结果
#根据java_teacher进行分组查询,查询出每一个老师所拥有的学生的数量
select java_teacher 教师工号, count(*) 学生数量 from student group by java_teacher;

#如果针对多列值进行汇总查询
#对java_teacher和student_name进行分组查询
#对于分组查询,select后的列只能是在group by中出现,以及组函数
select java_teacher 教师工号, count(*) 学生数量 ,student_name 学生姓名 from student group by java_teacher,student_name;

#如果对已经分组的sql需要进一步过滤条件,则使用having子句处理,having跟上表达式
#查询出教师拥有3个以上学生的记录
select java_teacher 教师工号, count(*) 学生数量 from student group by java_teacher having count(*)>=3;

#where和having区别?
#(1)where子句只能去过滤行记录,不能使用过滤组,但是having可以使用
#(2)where不能使用组函数

#其它常用函数
#1.字符串函数
#ASCII(str):获取字符串中的第一个字符串ascii值
#ctr+shift+r:执行选中的sql语句
select ascii(8);
select ascii('hello');#返回h的ascii值

#字符串长度相关函数
#char_length(str) length(str)
select length('hello world');

#判断某一个子串在主串第一次出现的位置
#locate(substr,str)
select locate('ld','hello world');
#如果没有匹配成功,返回0
select locate('lds','hello world');

#字符串填充函数
#比如要求指定的字符串长度是11,只设置了138,其它位数用指定的字符代替
select rpad('138',11,'*')

#字符串切割
#left(str,len)  right(str,len):控制一个字符串长度,超出长度len部分将被切除
select left('我爱你中国',3);
select right('我爱你中国',2);

#字符串截取
#substring(str,pos,len):从指定的位置开始,截取len个字符
select substring('hello world',3,3);

#2.日期相关函数
#返回指定日期是星期几
select dayofweek('2019-1-17');

#获取指定日期的天数
select dayofmonth('2019-1-17');

#获取日期中的月份
select month('2019-1-17');

#获取一个日期中星期的名称
select dayname('2019-1-17');

#获取一个日期中的月份名称
select monthname('2019-1-17');

#获取一个月的最后一天
select day(last_day('2019-1-17'));

MySQL类型与实体类中属性的java类型对应表

类型名称

显示长度

数据库类型

JAVA类型

JDBC类型索引(int)

VARCHAR

L+N

VARCHAR

java.lang.String

12

CHAR

N

CHAR

java.lang.String

1

BLOB

L+N

BLOB

java.lang.byte[]

-4

TEXT

65535

VARCHAR

java.lang.String

-1

INTEGER

4

INTEGER UNSIGNED

java.lang.Long

4

TINYINT

3

TINYINT UNSIGNED

java.lang.Integer

-6

SMALLINT

5

SMALLINT UNSIGNED

java.lang.Integer

5

MEDIUMINT

8

MEDIUMINT UNSIGNED

java.lang.Integer

4

BIT

1

BIT

java.lang.Boolean

-7

BIGINT

20

BIGINT UNSIGNED

java.math.BigInteger

-5

FLOAT

4+8

FLOAT

java.lang.Float

7

DOUBLE

22

DOUBLE

java.lang.Double

8

DECIMAL

11

DECIMAL

java.math.BigDecimal

3

BOOLEAN

1

同TINYINT

 

 

ID

11

PK (INTEGER UNSIGNED)

java.lang.Long

4

DATE

10

DATE

java.sql.Date

91

TIME

8

TIME

java.sql.Time

92

DATETIME

19

DATETIME

java.sql.Timestamp

93

TIMESTAMP

19

TIMESTAMP

java.sql.Timestamp

93

YEAR

4

YEAR

java.sql.Date

91

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值