现在的位置: 首页 > 综合 > 正文

sql语句

2014年05月15日 ⁄ 综合 ⁄ 共 559字 ⁄ 字号 评论关闭

查询存在重复字段的记录

select * from 表 group by 字段 having count(字段)>1


1.用一条SQL语句   查询出每门课都大于80分的学生姓名      
   
  name          kecheng          fenshu    
  张三           语文               81  
  张三           数学               75  
  李四           语文               76  
  李四           数学               90  
  王五           语文               81  
  王五           数学               100  
  王五           英语               90  
   
 (a)解:
select distinct name from table where name 
not in (select distinct name from table where fenshu <= 80)
 (b)解:
select 
  name  from   test   group   by   name   having   min(fenshu)  > 

抱歉!评论已关闭.