创建数据库
字符集:utf8 -- UTF-8 Unicode
排序规则:utf8_general_ci
创建表,插入数据
DROP TABLE IF EXISTS `db_school`.`t_student`;
create table t_student
(
id int not null AUTO_INCREMENT,
name varchar(50),
course varchar(50),
score int(10),
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `t_student`(name,course,score) VALUES ('张三', '语文', 81);
INSERT INTO `t_student`(name,course,score) VALUES ('张三', '数学', 75);
INSERT INTO `t_student`(name,course,score) VALUES ('李四', '语文', 76);
INSERT INTO `t_student`(name,course,score) VALUES ('李四', '数学', 90);
INSERT INTO `t_student`(name,course,score) VALUES ('王五', '语文', 81);
INSERT INTO `t_student`(name,course,score) VALUES ('王五', '数学', 100);
INSERT INTO `t_student`(name,course,score) VALUES ('王五', '英语', 90);
#用一条SQL 语句 查询出每门课都大于80 分的学生姓名
select name from t_student where score>80;
还是出现乱码,逐条插入时无乱码,批量插入有乱码