View Full Version : databse design problem

06-06-2007, 12:35 PM
hi everyone

I am designing the databse fro the students who will register on the site .

Each students will have some more persons working under them
theat student leader will then assign ids to Perons

so there will be group of say n number of persons working uder them.
Now the work will be divided between the persons like say money , project parts , transport , items to be bought

for single case , i desined two tables
users ---------ID , name
balance sheet --------------project id , item id ,..........
users-person -----------leaderid , personID , itemid

Things are good if there is only 1 students
LIke person A boght books with item iD 1 and is related to learserid 1
but in case of more students leader the value of ItemID will not be unique Leader 1 can have itemid 1 and leader 2 can also have itemid 1

Should i have to create new table leader{x} balance sheet and leader{x} every time the leader is registed so that all are separated.
Is this solution good to create new table every time

or i have to fill all the details of 100s of students in two tables only

I don't know which solution is more practicle

06-06-2007, 03:39 PM
I am not sure if i understand exactly what you want but in case of users(leaders)/users-persons and items i suggest a tables like this..

users (ID primary key auto_increment, name)
users-persons (ID primary key auto_increment, usersID)
items (ID primary key auto_increment, user-personsID)

06-06-2007, 03:40 PM
your current design is correct, always think in terms of more rows rather than more tables.