Database classic query questions student selection course Database: S (Sid, SNAME, AGE, SEX, DEPARTMENT, ADDRESS, BIRTHPLACE) SC (Sid, Cid, GRADE) C (Cid, CNAME, TEACHER) (1) course number and name taught by instructor Li; select cid, cnamefrom cwhere teacher = 'lil' (2) Student ID and name of a girl over 23 years old; select sid, snamefrom s www.2cto.com where s. age> 23 and sex = 'female '(3) names of all courses selected by "Li Xiaobo"; select c. cnamefrom cwhere c. cid in (select SC. cid from s, SC where s. sid = SC. sid and s. sname = 'Li Xiaobo '); (4) Name and Department of all students whose scores are over 80; select sname, departmentfrom swhere sid in (select sid from SC group by sid having min (grade)> = 80); (5) name of the student who does not take the "Operating System" course; select sname from s where s. sid not in (select SC. sid from SC, c where SC. cid = c. cid and c. cname = 'OS') (6) Name and Department of boys in the same township as "Li Xiaobo"; select s. sname, s. department from s www.2cto.com where s. sex = 'male' and s. birthplace = (select s. birthplace from s where s. sname = 'Li Xiaobo '); (7) students with better English scores than mathematics scores; (8) list of students with better English scores than boys who take the same course; (9) name and gender of the students who take at least two courses; (10) Number of students who have taken the courses taught by Mr. Li; (11) students who have not taken the courses taught by Mr. Li; (12) name, gender, and Department of the student with the highest score in the "Operating System" course;
Author radio123