aniltc
1
I have a registration form and I have some fields in the form.I am developing the db design for this.please have a look here
I have two user types
- type 1
- type 2
If I choose type 1.I will display some fields in the form such as name,password etc
If I choose type 2.I will display fields in the form such as name,password,milage,make,model etc.
Can anyone suggest the best normalized way of db design for this?
Is it possible to make single table and store everything in a table except types (obviously for type, i am going to make seprate table)
speda1
2
The type field should be an enum with whatever options you choose.
aniltc
3
But what about other fields,should I create all fields for both types in the table and make null values if the data is not available?
speda1
4
That would work, you’d just have to handle everything else programatically.
aniltc
5
I will use java script to show and hide the field and will store everything in the single table.Do you think its best for normalization ?
r937
6
in terms of normalization, you can definitely have one table to hold both types, with nullable columns as necessary
but please, don’t use ENUM, because ENUM is evil 