¿Í»§±ía(id name address) µÇ½Á÷Ë®±íb(id time) ¹ºÎïÁ÷Ë®±íc(id time productid productnum)
1.Çóÿ¸ö¿Í»§µÄ×îеǽʱ¼ätimeÐÕÃûname¿Í»§id
2.²é×îеǽ²¢ÇÒÒѾ¹ºÂòÉÌÆ·µÄ¿Í»§idnameµÇ½µÄʱ¼ätime(Ò»ÌõsqlÓï¾ä)
Ò»¸ö±ístudentÖÐÓа༶classidѧºÅid³É¼¨grade
1.¼ÆËã¸÷¸ö°àµÄƽ¾ù³É¼¨
2.²éÕұȸðàƽ¾ù³É¼¨¸ßµÄѧÉúµÄ°à¼¶classidѧºÅid³É¼¨grade
1.Çóÿ¸ö¿Í»§µÄ×îеǽʱ¼ätimeÐÕÃûname¿Í»§id
select a.ida.named.time as time
from a left join (select idmax(time) as time from b group by id) d
on a.id =d.id ;
2.²é×îеǽ²¢ÇÒÒѾ¹ºÂòÉÌÆ·µÄ¿Í»§idnameµÇ½µÄʱ¼ätime(Ò»ÌõsqlÓï¾ä)
select a.ida.named.time as time
from a(select idmax(time) as time from b group by id) d
where a.id =d.id
and exists (select * from c where id = a.id);
1.¼ÆËã¸÷¸ö°àµÄƽ¾ù³É¼¨
select classidavg(grade)
from student
group by classid;
2.²éÕұȸðàƽ¾ù³É¼¨¸ßµÄѧÉúµÄ°à¼¶classidѧºÅid³É¼¨grade
select a.classida.ida.grade
from student a
where a.grade >(select avg(grade) from student where classid = a.classid);