Select Exercise 4

Source: Internet
Author: User

21, inquires the score to choose to learn many courses of students in the score is not the highest score in all grades record.

SELECT * FROM score where CNO in (select CNO from Score GROUP by CNO have count (1) >1) and degree<> (select Max (d Egree) from score);

24. The name of the teacher who has more than 5 students who have enrolled in a course .

Select T.tname from teacher T joins course c on t.tno = C.tno where C.cno in (select CNO from Score Group by CNO have Cou NT (1) >5);

26, inquires the existence has the above grade achievement the course Cno.

Select CNO from score where degree in (select degree from score Group by degree have degree>85);

27. Find out The results table of the "computer Department" teacher teaching course.

Select s.* from score s joins course c on s.cno = C.cno join teacher T on t.tno = c.tno where T.depart = ' computer system ';

28, Query "computer Department" and "Electronic Engineering department" different titles of teachers Tname and Prof.

Select T.tname,t.prof from teacher T where t.prof in (select T.prof from teacher T Group by T.prof have count (1) =1)

29, Inquires the elective number is "3-105" the course and the result is at least higher than the elective number is "3-245" schoolmate's cno,Sno and degree, and presses degree Order from high to low.

Select Cno,sno,degree from score where cno= ' 3-105 '
and degree>= (select min (degree) from score where cno= ' 3-245 ') Order by degree Desc;

30, inquires the elective number is "3-105" and the result is higher than the elective number is "3-245" the course schoolmate's CNO,Sno and degree.

Select Cno,sno,degree from score where cno= ' 3-105 ' and degree> (select Max (degree) from score where cno= ' 3-245 ');

31. Check the name,sex and birthday of all teachers and classmates .

Select S.sname,s.ssex,s.sbirthday from student S Union select t.tname,t.tsex,t.tbirthday from teacher T;

32, query all "female" teacher and "female" classmate's name,sex and birthday.

Select S.sname,s.ssex,s.sbirthday from student s where s.ssex= ' female ' union select T.tname,t.tsex,t.tbirthday from teacher T W Here t.tsex= ' Women ';

Select Exercise 4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.