A given location (city), can have a name and also other aliases by which it can be known. I need to model this in a database.
Search can be executed using either city or any of its alias:
For e.g.
City:
- name: Los Angeles
- alias: LA
When specifying the search criterion, I can either specify LA or Los Angeles, and it should return the same result (e.g. Hollywood).
I was thinking of doing it using One-To-Many relation where 1 city can have many aliases, and many aliases can map to one city.
When doing a search, I use a join of city and cityAlias table to find the correct city.
Is there a better way to deal with this?
EDIT: (For anyone who runs into the same problem/requirements and happen to comes to this page) Please see my answer as well, since I ended up using that, but the marked answer helps you identify unique cities.