基本概念
数据库增删改查面试题练习
1、统计学号student_id中包含201911的学生姓名的记录条数
select count(student_name) from students where student_id like "%201911%";
2、在成绩表TBL.SCORES中插入一条记录student id-20191111,科目-计算机,成绩=90
insert into scores values('20191111','计算机',90)
3、删除学生表TBL STUDENTS中学号student id 小于20191231 记录
delete from students where student_id < 20191231;
4、修改成绩表 TBL_SCORES 中科目 subject id=外语的成绩 score=98
update scores set score = 98 where subject_id = "外语";
5、分别列出成绩表 TBL_SCORES 中成绩score的汇总值、最大值、最小值
select sum(score), max(score),min(score) from scores;
6、查询成绩score-100的学生姓名 student_name
select student_name from students
inner join scores
on scores.student_id = students.student_id
where score = 100;
存储过程了解吗? 主要用来做什么?
了解。
比较复杂的查询语句放到存储过程中,下次使用的时候直接通过调用存储过程来进行查询。
批量插入数据的时候也可以使用存储过程来做。