Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is how I would solve the problem (assuming of course that you have control of the DB, and can modify tables/add tables, or even control the original load of the DB).</p> <p>My solution would use 2 tables -> one table would just be a list of every possible letter combination from your dictionary with the component letters sorted alphabetically. (IE TEST would be ESTT, TESTER would be ERSTT, DAD would be ADD).</p> <p>The second table would have every word and a reference to the key for table one.</p> <p>Table One - LetterInWord</p> <pre><code>Index Letters 1 ESTT 2 ESTTER 3 EST 4 ADD 5 APST </code></pre> <p>In table one, you insert the words letters in alphabetical order - test becomes estt</p> <p>Table Two - Words</p> <pre><code>Index LetterInWordIndex Word 1 1 TEST 2 2 TESTER 3 3 SET 4 4 ADD 5 4 DAD 6 5 SPAT 7 5 PAST </code></pre> <p>In table 2 you insert the word with appropriate word and index reference.</p> <p>This will be a one to many relationship -> One entry in LetterInWord table could have multiple entries in Words table</p> <p>Non-wild card look up: Say my input letters are SETT Sort them alphabetically.</p> <p>Then in the look up, you select all "Letters" from LetterInWord where Letters = value and join on table Words - your output in one query is a list of all words that only contain those letters</p> <p>Now for wild cards: Say my input letters are EST* Remember the length - 4 Strip out the wildcards - you get EST (make sure you sort this alphabetically) Now look for all cases where Letters contains EST and Letters Length &lt;= 4 joined on Words table</p> <p>That would return TEST, REST, SET, etc</p> <p>I'm not sure if that is the most efficient method, but it works. I have used it in the past to do word look ups from dictionaries, and it has reasonable performance with minimal complexity.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload