Database Design: Defining Data Access from a List of Cities -
I am trying to create an API which provides data on different cities.
Currently, APIPriv is a table called, which has the following columns:
=========== == ====================================== ID ApiPriv | IdClient | Daily | Hourly | Devkai ================================================= == 1 | 23 'Y' | 'N' | [MD5 hex] idClient is a foreign key for the customer table.
Daily and hourly are data types - ' Y ' means customer / developer has access to data And ' N ' means he / she does not.
DevKey is an autogenerated MD5 string provided for the developer, which is used as a developer key.
Now, for every developer, APIs and databases are required to store a list of cities associated with each developer. Developer will only retrieve data from these cities
How do I define it in the database? The number of cities in a list is not certain. A developer can have access to 5 cities, from the second to the 10th, the second to the 7th.
(should already be a master City subset of the data table, which as of 1500 cities and naturally, the list of cities for each developer. )
If you need a cooperative table for cities, with some of its effects:
idDevCityPriv | IdApiPriv | IdCity ==================================== 1 1 34 2 1 42 Select c A joining internal joining DevCityPriv d .idAPIPriv = d.idAPIPriv city d.idCity = c.idCity where a.DevKey = c on the Apiaipiaiar [DevKeyVariable] Cheers , Eric
Comments
Post a Comment