Database Design - Where to start?

Associate
Joined
20 May 2007
Posts
441
Hey everyone,

Im new to using server side programming for webdevelopment, now I'm sure I'll be fine accessing and querying the database but i literally have no idea about how to set things up in terms of tables in a database.

So i intend to use for for a arbitrary number of tasks for a number of users, some settings for each user.

So I was thinking should I have a table of user's which contain a user ID, then use this to query a settings table and a tasks table?

I'm sorry if this sounds stupid but I'm sure you people would be able to point me in the right direction.

Many thanks
 
Yeah you should be fine with that, just set the id to be the primary key and you can use that to do your joins etc.
 
If you have only a few settings and dont intend to add more then I would use a single table for:

id username setting1 setting2 etc

However if you're thinking of using a lot (say more than 15) you'll might be better off with two tables

id username

id setting1 setting2 setting3 etc

and finally for both you'd probably want a tasks table

id task1....
 
If you have only a few settings and dont intend to add more then I would use a single table for:

id username setting1 setting2 etc

However if you're thinking of using a lot (say more than 15) you'll might be better off with two tables

id username

id setting1 setting2 setting3 etc

and finally for both you'd probably want a tasks table

id task1....

Another option would be to have a settings table which contains the names of settings and then a link table that has user_id, setting_id and value.

Also, if you want your users to have more than 1 list, perhaps starting with a list table that then has list items linked to it would be a good idea.
 
Hey philjohn that does snd like a gd idea

Im just trying to make this as flexible as possible and i might get to a stage where i will want different lists of tasks per user, so would i have a seperate table for each list or one table containing pointer to each list in the table?

Sorry I got a bit lost with what you were saying

Cheers
 
Hi matt,

you'd have the following tables:

users
lists
list_items

list_items would have a field list_id, pointing to the PK of the lists table and the lists table would have a user_id field pointing to the PK of the users table, the title of the list and any required metadata (date created, order in menu etc.) would go in the lists table.
 
Back
Top Bottom