SELECT S.name FROM Student S WHERE S.score > 80 GROUP BY S.name Having count(*)>=2;
SELECT S.name
FROM Student S
WHERE S.score > 80
GROUP BY S.name Having count(*)>=2
沒有分組的狀況下having和Where 相似。函數
有分組的時候 Where 對分組前內容過濾,having是分組後的內容進行篩選。code
having 裏面能夠寫聚合函數,select
select phone from aa group by phone having count(*) > 1