I have to insert an user with nearly 40 fields like age,sex,etc. How i can insert these datas by creating single table or multiple tables?
You create the tables according to the relations between the data.
U mean by using a unique id for all the tables
At some point you’ll want to use unique ids, correct.
I am certainly far from being an expert so this is just the way i would do it but if it is some data that will only ever be linked to the user as 1 value i’d keep it in the same table. e.g Age
It is impossible that your user is going to be aged 24 and 28 or male and female (well i guess technically some people are but you can have a 3rd catergory) at the same time so there is no point creating an ‘age’ or ‘sex’ table with an id to link to the user.
If you want to store ‘cars’ that a user owns then a relational table is the correct choice as they might have a bmw and a volvo etc etc/
which is my interpretation of what @Dormilich says above.
Consider i’m adding three option like profiles, qualification, marks.
*Admin wants to add those details seperately,
*If he adds profile details of user John doe in 1st form.
*Then he comes to second form that is qualification .How he knows that this part of John doe details
If you only want to allow male/female as genders, then a boolean field will suffice. However, if you want to support other genders then a separate gender table should be used (mind that primary keys do not need to be integers).
If the code that runs when the first form is submitted is also the code that draws the second form, then it can populate a hidden form variable with the new id that “John Doe” was assigned when the data was inserted into the table.
Exactly this is what i followed
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.