第六次作业
这个作业属于哪个课程 | https://edu.cnblogs.com/campus/uzz/cs3 |
---|---|
这个作业要求在哪里 | https://edu.cnblogs.com/campus/uzz/cs3/homework/13086 |
这个作业的目标 | https://edu.cnblogs.com/campus/uzz/cs3/homework/13086 |
alter table curriculum drop primary key;
alter table grade drop primary key;
alter table student_info drop primary key;
use studentsdb;create unique index cno_idx on curriculum(课程编号);
create index grade_idx on grade(分数);
create index grade_sid_cid_idx on grade(学号,课程编号);
show index from grade
drop index grade_idx ON grade;
create view v_stu_c as select s.学号,s.姓名, g.课程编号 from student_info as s,grade as g where s.学号=g.学号;
select * from v_stu_c where 学号 ='0003';
create view v_stu_g as select student_info.学号,student_info.姓名,curriculum.课程名称,grade.分数 from student_info ,grade ,curriculum where student_info.学号=grade.学号 and grade.课程编号=curriculum.课程编号;
select avg(分数) from v_stu_g where 学号='0001';
alter view v_stu_g as select 学号,姓名,性别 from student_info ;
insert into v_stu_g (学号,姓名,性别) values (0010,'陈婷婷','女');
delete from v_stu_g where 学号='0010';
update v_stu_g set 分数 = '87' where 课程名称='高等数学' and 姓名='张青平';
drop view v_stu_g;
drop view v_stu_c;