I have a dictionary in an MYSQL table, the table consists of 240 000 words. If I for example have the letters G, I, G, S, N and O I would like to select all the words in the table that contain all or some of these letters (and no other letters).
Acceptable words would for example include:
- going
- song
- son
- so
- on
Examples of unacceptable words:
- songs (one S more than allowed)
- words longer that the number of characters (6 in this case)
What would the MYSQL query look like?
My current MYSQL looks like:
SELECT * FROM `list`
WHERE word like '%S%' and word like '%O%' and word like '%G%'
I want to use 6 or 7 letters and find words that are:
- equally long
- shorter
Now I only find words that are equally long or longer and that contain other letters as well.