数据库实验四
1
create table test4_01 as
select *
from pub.student_41;
alter table test4_01 add sum_score int ;
update test4_01
set sum_score =(
select sum(score)
from pub.student_course
1 //where test4_01.sid=pub.student_course.sid
group by pub.student_course.sid);
2 //where test4_01.sid=select sid
from pub.student_course
等价吗??可以这么写吗?1 情况的话 Group by 是不是可
以不用加?
2
create table test4_02 as
select *
from pub.student_41;
alter table test4_02 add avg_score numeric( 4,1);
update test4_02
set avg_score=(
select avg(score)
from pub.student_course
where test4_02.sid=pub.student_course.sid
group by sid);
3
create table test4_03 as
select *
from pub.student_41;
alter table test4_03 add sum_credit numeric(5,1) ;
update test4_03
set sum_credit=(
select sum(credit)
评论0
最新资源