简体   繁体   中英

Database design for international suppliers and their support language

I am new to the database world and want to design a database which contains many service providers. Some provide their services all over the world, some only for a few states. Also, I need to store the language in which they can support their customers.

I want to query efficiently:
1) All suppliers servicing a certain state.
2) All suppliers which support a certain language.

I thought of the following design:

  • Country_Table {countryID : PK ...}
  • State_Table {stateID: PK, countryID : FK ...}
  • Language_Table {languageID: PK, ....}
  • Supplier_Table {supplierID : PK, supplierName, supplier address...}
  • Supplier_Language_Table {supplierID : PK,FK , languageID : PK, FK}
  • Supplier_State_Table { supplierID : PK, FK , stateID: PK, FK}

I have a few problems with this design:

  1. What to do in case of a country that has no states (for instance: Egypt)? I thought of using countryID=0 for these cases. So in Country_Table, Texas is the state and USA is the country. However, Egypt is a state with countryID 0 . Is this a valid solution?
  2. For each language the supplier supports I need to insert a row. Is it efficient for later querying suppliers by language or is there a better solution?
  3. In Supplier_State_Table I need to insert a row for each state the supplier provides. This seems inefficient. I thought of using stateID 0 to indicate the whole world. But even then, if supplier provides service to US only, having a data row for each US state seems crazy.

Any help would be appreciated.

1) No. Instead, have both a Supplier_State_Table and Supplier_Country_Table

2) This is fine.

3) Again, this is fine, databases are designed to handle a lot of data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM