1、select sc_name from score where sex='女' and substr(sc_number,1,2)='98';
2、select sc_name,co_name,sc_score from score s,course c where s.sc_courseid=c.co_id and sc_score<60;
3、 select s.name,F.a
from student s,
(select studentid,avg(score) a from
(select score, studentid
from score
where studentid in (select studentid
from score
where score < 60
group by studentid
)) t
group by studentid) f
where s.id=f.studentid
order by F.a
4、declare cursor myCur is
select score
from score
c1 myCur%rowtype;
begin
open myCur;
loop fetch myCur into c1;
if sc_ismakeup=1 then
dbms_output.put_line('补考成绩' || || c1.score );
else c1 myCur%rowtype;=0 then
dbms_output.put_line('原来成绩' || || c1.score );
exit;
end if;
end loop;
close myCur;
end;
|