SQL学习ing
SQL学习ing

SQL学习ing

先放个作业吧,有点难….

1
create table Student (
 s_id int auto_incerment,
 s_name varchar(20) ,
 s_birth date,
 primary key (s_id));
)

2 课程总数
select student.s_id,student.s_name,count(score.c_id) as "课程总数",sum(score.s_score) as "总成绩"
    from student,course,score
    where student.s_id=score.s_id 
    group by s_id
    ;

3 
select student.s_name as "姓名"
    from student
    where student.s_id not in (
        select score.s_id from score 
        where score in (
            select course.t_id from course
            where course in (
                select teacher.t_id 
                where teacher.t_name="colan"
            ) 
        )
    );


4
select student.s_name from student
    where student.s_id = score.s_id
    group by student.s_id
    having count(c_id)<(
        select count(c_id) from course
    );

5
select student.name from student, score
    where student.s_id = score.s_id and score.c_id in (
        select c_id from score where s_id=100
    );

6
select student.s_name from student
    where student.s_id = score.s_id 
    group by course.c_id;

7
update teacher set t_name="李桦" where t_name="李华";

8
delete from course where c_name like "%实战%"

作业,基本上全错,都跑不起来,各种报错

我感觉,课堂进度推得太快了。不过还好,反正我一直都是自学,不耽误。数据库对于后端来说很重要,我也接触了MySQL,也该好好学学。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注