两个例子:
1.查找 手机号和座机号
“13788332312 15788332313 029-88665433 012768 0296676 0377-87832341 155555655765336”
“[01][0-9]{2,3}-?[0-9]{8}”
2.查找邮箱
“7987778@qq.com yuy79879887@sina.com”
[0-9a-zA-Z]{2,25}@[0-9]{2,6}.com| [0-9a-zA-Z]{2,25}@[a-z|A-Z]{2,6}.com
作业:
1、查询名字中含有"风"字的学生信息select * from student where s_name like '%风%';2、查询男生、女生人数select s_sex,count(*) from student GROUP BY s_sex;3、查询每门课程被选修的学生数select c_id,count(*) from score GROUP BY c_id;4、查询1990年出生的学生名单select * from student where s_brith=1990;5、查询所有同学的学生编号、学生姓名、选课总数、所有课程的总成绩select student.s_id,s_name,count(*) as "选课总数",sum(s_score) from studentINNER JOIN score on student.s_id=score.s_id GROUP BY score.s_id;6查询平均成绩大于等于60分的同学的学生编号和学生姓名和平均成绩select student.s_id,s_name,avg(s_score) from studentINNER JOIN score on student.s_id=score.s_idGROUP BY score.s_id having avg(s_score)>60;7查询不及格的课程,并显示课程名,课程id和学生idselect course.c_name,score.c_id,s_id from scoreINNER JOIN course on course.c_id=score.c_idwhere s_score<60;8/检索"01"课程分数小于60,按分数降序排列的学生信息select c_id,s_score from scorewherec_id=01 and s_score<60ORDER BY s_score DESC;9/ 查询选修了全部课程的学生信息select student.s_id,s_name,s_brith,s_sex from studentINNER JOIN score on student.s_id=score.s_idGROUP BY score.s_id having count(*)=3;10/查询每门课程的平均成绩,结果按平均成绩降序排列,平均成绩相同时,按课程编号升序排列select c_id,avg(s_score) from scoreGROUP BY c_idORDER BY avg(s_score) DESC ,c_id;11/查询学过"张三"老师授课的同学的信息select student.s_id,s_name,s_brith,s_sexFROM studentINNER JOIN scoreINNER JOIN courseINNER JOIN teacherwhere t_name='张三'GROUP BY s_id;12/查询不及格的课程select course.c_name,score.c_id,s_id from scoreINNER JOIN course on course.c_id=score.c_idwhere s_score<60;14/查询选修了全部课程的学生信息select student.s_id,s_name,s_brith,s_sex from studentINNER JOIN score on student.s_id=score.s_idGROUP BY score.s_id having count(*)=3;
