Question

I have a table that has a list of schools, companies, etc. and users are able to choose where they work. If a record for the workplace someone enters doesn't exist it will be added to the table. but there is some confusing names. for example imagine a school named 4th of July. one may enter "4th of July" someone else would write "forth of July". I need to enter synonyms of names like this to assure that there aren't workplaces with 2 or 3 different records (different IDs).

I have came up with 2 different ideas:

  1. having single table that synonyms have the same gid (group id)

    ID      Name              Gid         IsDefaultDictation
    
    1       Google            1              1
    2       4th of July       2              1
    3       Forth of July     2              0
    
  2. having another table named sysnonyms like:

table 1:

ID      Name
-------------------------
1       Google 
2       4th of July

table 2:

ID        Name                SynonymForID
------------------------------------------
3         Forth of July          2

which one is more appropriate?

Was it helpful?

Solution

From experience I would strongly advise to not allow users to enter in whatever they want if a record is not found. Official synonyms might be ok (StackOverflow does this for tags), but for your own sanity, I would recommend not doing it.

Some reasons:

  1. You will likely end up writing a tool that consolidates the synonyms. Think about reports and statistics that you might want to run. Think about search. All of this is complicated by having synonyms.

  2. Users are very creative with data. You won't just see one variation on "4th of July", you'll see 100 of them.

  3. Consider other sites on the web. Something like Glassdoor doesn't have synonyms that I know of. There is simply one official name for a company. The search engine might match a synonym to an official company, but I would guess they don't actually store it.

  4. Having work with a table that had 1.5 million synonyms, I remember it was hell to work with stakeholders. "Just make sure it checks our list of synonyms!" was what I would constantly hear. It was not performant and made any code that had to deal with it very complex.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top