create table teacher ( tid int(10) primary key auto_increment, tname varchar(20), tage int(10) ); use studb;
create table student ( sid int(10) primary key auto_increment, sname varchar(20), sage int(10), tid int(10) REFERENCES teacher(tid) );
--select teacher.tname from teacher,student where student.sname = '张三' select t.tname from teacher t,student s where s.sname = '张三' and t.tid = s.tid
create table course ( cid int(10) primary key, cname varchar(20), tid int(10) REFERENCES teacher(tid) );
create table sc ( scid int(10) primary key, sid int(10) REFERENCES student(sid), cid int(10) REFERENCES course(cid), score int(10) );
select c.cname from course c,student s,sc where s.sname = '小张' and s.sid = sc.sid and c.cid = sc.cid;
select sname from student s,course c,sc where c.cname='android' and sc.score>=60 and s.sid = sc.sid and c.cid = sc.cid;
delete from sc where sid = (select sid from student where sname = '小张');
update sc set score=score+5 where cid=????; select tid from teacher where tname='李老师' ==1 select cname from course where tid = 1 ==课程名字,李老师教的 select cid from course where cname='android' ==课程ID update sc set score=score+5 where cid= ( select cid from course where cname= ( select cname from course where tid = ( select tid from teacher where tname='李老师' ) ) );
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有