mysql 一些常见问题的解决

1

输入代码:

create table Student(SId varchar(10),Sname varchar(10),Sage datetime,Ssex varchar(10));

insert into Student values('01' , '赵雷' , '1990-01-01' , '男'),
('02' , '钱电' , '1990-12-21' , '男'),
('03' , '孙风' , '1990-05-20' , '男'),
('04' , '李云' , '1990-08-06' , '男'),
('05' , '周梅' , '1991-12-01' , '女'),
('06' , '吴兰' , '1992-03-01' , '女'),
('07' , '郑竹' , '1989-07-01' , '女'),
('09' , '张三' , '2017-12-20' , '女'),
('10' , '李四' , '2017-12-25' , '女'),
('11' , '李四' , '2017-12-30' , '女'),
('12' , '赵六' , '2017-01-01' , '女'),
('13' , '孙七' , '2018-01-01' , '女');

报错:
Incorrect string value: ‘\xE8\xB5\xB5\xE9\x9B\xB7’ for column ‘Sname’ at row 1
原因:Sname,Ssex的编码类型不支持中文
修改方法:将Sname,Ssex的编码类型改为utf8

create table Student(SId varchar(10),Sname varchar(10) CHARACTER SET utf8,Sage datetime,Ssex varchar(10) CHARACTER SET utf8);

2

在mysql中使用rank()函数报错,原因mysql5.7不支持rank函数

你可能感兴趣的:(sql,mysql,数据库,database)