Database Exercises 26-45 Questions

Source: Internet
Author: User

1-- -, the inquiry has 85 points above the course CNO.2 SelectDistinct Cno fromScorewhereDegree > -3 4-- -, and the results of the "computer department" Teachers ' teaching courses were queried. 5 Select* fromScorewhereCnoinch(SelectCno fromCoursewhereTnoinch(SelectTno fromTeacherwhereDepart ='Computer Department'))6 7 8--0028, and inquires into the tname and prof of teachers with different titles of "computer department" and "Electronic Engineering department". 9 SelectTname,prof fromTeacher T1whereDepart ='Computer Department'And NOT EXISTS (Select* fromTeacher T2whereDepart ='Department of Electronic Engineering'and T1. Prof =t2.prof)Ten Union One SelectTname,prof fromTeacher T1whereDepart ='Department of Electronic Engineering'And NOT EXISTS (Select* fromTeacher T2whereDepart ='Computer Department'and T1. Prof =t2.prof) A  ---0029, the query elective number is "3- the"The course is at least higher than an elective number"3-245"The CNO, Sno and degree of the classmates, and sorted by degree from high to low order. --any one value, all of the values - Select* fromScorewhereDegree >any (SelectDegree fromScorewherecno='3-245') and Cno ='3-105'ORDER BY degree desc the  --- -, the query elective number is "3- the"And the score is higher than the elective number."3-245"CNO, Sno and degree of the students in the course. - Select* fromScorewhereDegree > All (SelectDegree fromScorewherecno='3-245') and cno='3-105'  -  +-- to, check the name, sex and birthday of all teachers and classmates. -     SelectSname,ssex,sbirthday fromStudent + Union A     SelectTname,tsex,tbirthday fromTeacher at  --- +, query the name, sex and birthday of all "female" teachers and "female" classmates. -     SelectSname,ssex,sbirthday fromStudentwheressex='female' - Union -     SelectTname,tsex,tbirthday fromTeacherwheretsex='female' -  in-- -, and the results of students who have a lower average score than the course.  -     Select* fromScore S1wheredegree< (SelectAVG (degree) fromScore S2 GROUP BY Cno has S1. cno=S2. Cno) to  +-- the, query all teachers tname and depart. -     SelectTname,depart fromTeacherwhereTnoinch(SelectTno fromCoursewhereCnoinch(SelectCno fromscore)) the  *-- *, the Tname and depart of all teachers who have not been lectured. $     SelectTname,depart fromTeacherwhereTno notinch(SelectTno fromCoursewhereCnoinch(SelectCno fromscore))Panax Notoginseng  --- $, check the class number of at least 2 men. --Select all the boys first, then group by class. the     SelectClass fromStudentwheressex='male'GROUP BY Class has COUNT (*) >1 +  A--Panax Notoginseng, query the student table, not the surname "Wang" student records.  the     Select* fromStudentwhereSname not like'Wang%' +  ---0038, query the name and age of each student in the student table.  $--Note: Year (GETDATE ()) Gets the current time "years" getdate () gets $     SelectSname,year (GETDATE ())-year (Sbirthday) asAge fromStudent -  --- the, querying the largest and smallest sbirthday date values in the student table.  the      SelectMAX (Sbirthday), MIN (Sbirthday) fromStudent - Wuyi-- +, querying all records in the student table in the order of class number and age from large to small.  the     Select* fromStudent ORDER BY Class desc,sbirthday ASC -   Wu-- A, query "male" teachers and their courses.  -     SelectCname,tname fromCourse Join Teacher on Course.tno=teacher.tnowheretsex='male'--Union of 2 tabular practices About      $ Select* fromCoursewhereRninch(SelectRn fromTeacherwheretsex='male')    --where procedure -  --- the, Query the SNO, CNO and degree columns of the highest score.  -     SelectSno,cno,degree fromScorewheredegree = (SelectMAX (degree) fromScore)--Method One A  +     SelectTop1* fromScore ORDER BY degree desc--Method Two the  --- +, inquiries and "Li June" with the sex of all the students of the sname. $     SelectSname fromStudentwhereSsex= (SelectSsex fromStudentwhereSname='Li June') and Sname! ='Li June' the  the-- -, inquiries and "Li June" with the same sex and classmates sname. the     SelectSname fromStudentwhereSsex= (SelectSsex fromStudentwhereSname='Li June') and class= (SelectClass fromStudentwhereSname='Li June') and Sname! ='Li June'--Method One the  - SelectSname fromStudent S1wheressex=( in SelectSsex fromStudent S2whereSname='Li June'and S1.class= S2.class the)--Method Two the  About-- $, and query all the "male" students who have enrolled in the "Introduction to Computer" course.  the     Select* fromScorewhereCno= (SelectCno fromCoursewhereCname='Introduction to Computers') and Snoinch(SelectSno fromStudentwheressex='male')--f Method 1

26-45 questions about database exercises

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.