create database db_test charset=utf8;
use db_test;
专业表
create table major(
mid int,
mname varchar(255)
)
学生表
create table student(
sid int,
sname varchar(255),
score float,
joindate DATE
)
查询学生表中所有学生记录
select * from student;
查询姓名为刘德华的学生信息
select * from student where sname=“刘德华”;
查询2018年入学的学生姓名、分数和入学时间
select sname,score,joindate from student where joindate between “2018-01-01” and “2018-12-31”;
查询专业编号为30并且分数高于80分的学生信息
select * from major m inner join student s on m.mid=s.smid where m.mid=30 and s.score > 80;
查询名字是3个字的所有学生信息
select * from student where sname lik