LoginSignup
0
1

More than 3 years have passed since last update.

[SQL] LeetCodeの無料問題集を活用して、SQLを使いこなし(6)

Posted at

Q182 Duplicate Emails

Q182.png

質問

重複なメールアドレスを探します。

Code書き方のHint

count関数とhavingを組み合わせて、重複のデータが探せます。
※WHEREはCOUNT関数と一緒に使えない。

SELECT 列名 FROM テーブル名
GROUP BY 列名
HAVING COUNT(列名)>1;

Code

SELECT Email FROM Person
GROUP BY Email
HAVING COUNT(Email)>1;

Result

Q182_result.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1