现在 Student表有 如下数据 现需求如下: 查找每个老师的学生的平均年龄且平均年齿大于12 不使用 HAVING 1 SELECT * FROM (SELECT TeacherID, AVG(Age) AS AGE FROM Student 2 GROUP BY TeacherID) T WH Read More
posted @ 2017-02-14 17:29 老糖 Views(36242) Comments(0) Diggs(1) Edit
首先创建两张表 1 CREATE TABLE Teacher 2 ( 3 Id INT IDENTITY(1,1) NOT NULL PRIMARY KEY, 4 Name VARCHAR(10) NOT NULL, 5 ); 6 7 8 CREATE TABLE Student 9 ( 10 Id Read More
posted @ 2017-02-14 16:45 老糖 Views(379) Comments(0) Diggs(0) Edit