user3501798
user3501798

Reputation: 43

How to obtain and count '@gmail.com' from a column of email accounts in SQL

Im trying to obtain and count the number of accounts with a gmail domain. I'm unsure how to do it. Any help would be great.

Upvotes: 0

Views: 222

Answers (2)

Mudassir Hasan
Mudassir Hasan

Reputation: 28741

SELECT COUNT(*) as numGmailAccounts
FROM tableName
WHERE emailColumn like '%gmail.com'

Upvotes: 2

juergen d
juergen d

Reputation: 204756

select sum(instr(some_column, '@gmail.com') > 0) as gmail_count
from your_table

Upvotes: 1

Related Questions