Last active
December 29, 2015 04:29
-
-
Save alexandregz/7615306 to your computer and use it in GitHub Desktop.
MySQL query to get total from each distinct initial letter from a dictionary database, with special cases like suffix (-grafia, -inho)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- MySQL query to get total from each distinct initial letter from a dictionary database, with special cases like suffix (-grafia, -inho) | |
-- Fields: dic_word, DB: nuke_dictionary | |
-- | |
SELECT | |
IF( | |
SUBSTRING( dic_word, 1, 1 ) IN ('&', '-'), | |
SUBSTRING( dic_word, 2, 1 ), | |
SUBSTRING( dic_word, 1, 1 ) | |
) AS inicial | |
, COUNT(*) AS total | |
FROM nuke_dictionary WHERE 1 | |
GROUP BY inicial | |
ORDER BY inicial |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment