数据库:
导入
导出
命令:
mysqldump -uroot -p666 dbname > 1.sql
mysqldump -uroot -p666 dbname < 1.sql
1、导入数据
mysqldump
2、掠过
3、
- avg获取平均值
select student_id,avg(num) from score group by student_id HAVING avg(num) > 60
- 连表
select * from score LEFT JOIN student on score.student_id = student.sid
- 临时表
select age,name from (select nid,name,age from tb1 where id>10) as T
4、
select student_id from score where course_id in (
select cid from course left join teacher on course.teacher_id = teacher.tid where teacher.tname='李平老师'
) group by student_id
5、查询有课程成绩小于60分的同学的学号、姓名;
select student_id from score where num < 60 group by student_id
- DISTINCT 去重