sql统计教授多门课老师的数量
CREATE TABLE `Course`(
`c_id` VARCHAR(20),
`c_name` VARCHAR(20) NOT NULL DEFAULT '',
`t_id` VARCHAR(20) NOT NULL,
PRIMARY KEY(`c_id`)
`c_id` VARCHAR(20),
`c_name` VARCHAR(20) NOT NULL DEFAULT '',
`t_id` VARCHAR(20) NOT NULL,
PRIMARY KEY(`c_id`)
);
insert into Course values('01' , '语文' , '01');
insert into Course values('02' , '数学' , '01');
insert into Course values('03' , '英语' , '03');
insert into Course values('04' , '历史' , '03');
insert into Course values('05' , '地理' , '03');
insert into Course values('06' , '生物' , '04');
以上是测试表,但是我这样写为什么查不出来呢
insert into Course values('02' , '数学' , '01');
insert into Course values('03' , '英语' , '03');
insert into Course values('04' , '历史' , '03');
insert into Course values('05' , '地理' , '03');
insert into Course values('06' , '生物' , '04');
以上是测试表,但是我这样写为什么查不出来呢
select count(*) from course
group by t_id having count(*)>1
求大神指导
#SQL Server#group by t_id having count(*)>1
求大神指导