Skip to main content
Participant
October 20, 2011
Answered

How should I set up a database for my mobile app?

  • October 20, 2011
  • 1 reply
  • 638 views

I am developing a mobile app that will allow users to check current "weather" ( I hesitate to share the exact nature of my app on a public forum, so I'll use "weather" instead ) reports around the country.  A network of contributors around the nation will upload their content, and I need to be able to access this information from my app. 

Having never set up a database before, I am unsure what the best way to do this is.  I envision a portal on the internet that my contributors can upload at, and then just linking to that database in my app.  How can I do that?  Or is there a better way?

This topic has been closed for replies.
Correct answer Ben M

You can utilize any database that your site does.  So let's start with that.  Do you plan on using mySQL or MS SQL?  Then the next consideration is whether your input is coming from controlled sources.  For example, with your weather example can we safely say that user 1 will report on areas 1, 3 & 5 and user 2 reports on 2 & 4, meaning there is no overlap.  Then what would happen is you need to evaulate the other fields that will be entered.  I would typically start with:

User table - user info, username, password, (permissions?)

Data table - define regions, weather info data, date of information,

User_Region Assignment table - each row links 1 user to 1 region (easier than storing arrays in user table)

Permissions table - do you need users to have permission, will there be an admin to override if something goes wrong?

Depending on the scale of the app, making Foreign Key dependancies may be necessary.  Basically that's just a fancy way of saying if region 2 gets deleted for some reason we want to make sure that users are assigned to other territorities otherwise you get query errors trying to look for something that doesn't exist.

That's the basics.  There is a lot involved but if you are unfamiliar with database design and setting up indexing keys, foreign keys, and setting up the model, you may want to consider hiring outside help because it is a lot of work and if you are thinking of growing you should build the database with growth in mind.

1 reply

Ben MCommunity ExpertCorrect answer
Community Expert
October 20, 2011

You can utilize any database that your site does.  So let's start with that.  Do you plan on using mySQL or MS SQL?  Then the next consideration is whether your input is coming from controlled sources.  For example, with your weather example can we safely say that user 1 will report on areas 1, 3 & 5 and user 2 reports on 2 & 4, meaning there is no overlap.  Then what would happen is you need to evaulate the other fields that will be entered.  I would typically start with:

User table - user info, username, password, (permissions?)

Data table - define regions, weather info data, date of information,

User_Region Assignment table - each row links 1 user to 1 region (easier than storing arrays in user table)

Permissions table - do you need users to have permission, will there be an admin to override if something goes wrong?

Depending on the scale of the app, making Foreign Key dependancies may be necessary.  Basically that's just a fancy way of saying if region 2 gets deleted for some reason we want to make sure that users are assigned to other territorities otherwise you get query errors trying to look for something that doesn't exist.

That's the basics.  There is a lot involved but if you are unfamiliar with database design and setting up indexing keys, foreign keys, and setting up the model, you may want to consider hiring outside help because it is a lot of work and if you are thinking of growing you should build the database with growth in mind.

oldredcj7Author
Participant
October 20, 2011

Thanks for the reply.  I was planning to use mySQL, but after a couple days of looking more into it, I think it might be a good idea to get some outside help.  I appreciate your advice.