sql server – Database normalization. Which is better, inserting in one row or multiple row?

sql server – Database normalization. Which is better, inserting in one row or multiple row?

I would go for 3 tables:

user_type

typeID | typeDescription

Main_table

id_main_table | id_user | id_type

table_bhg_i

id_bhg_i | id_main_table | data1 | data2 | data3

Although I see you are inserting IDs for each user , I dont quite understand how are are you going to differentiate between the users , had I designed this DB , I would have gone for tables like

tableName: UserTypes

this table would contain two field first would be ID and second would be type of user
like

UsertypeID | UserType

the UsertypeID is a primary key and can be auto increment , while UserType would be your users pyd ,ppk or so on . Designing in this way would give you flexibility of adding data later on in the table without changing the schema of the table ,
the next you can edit a table for generating multiple users of a particular type, this table would refer the userID of the previous table , this will help you adding new user easily and would remove redundancy

tableName:Users

this table would again contain two fields, the first field would be the id call and the secind field would be the usertypeId try

UserId |UserName | UserTypeID

the next thing you can do is make a table to insert the data , let the table be called DataTable

tableName: DataTable

this table will contain the data of the users and this will reference then easily

DataTabID | DataFields(can be any in number) | UserID(refrences Users table)

these tables would be more than sufficient .If doubts as me in chatbox

sql server – Database normalization. Which is better, inserting in one row or multiple row?

Leave a Reply

Your email address will not be published. Required fields are marked *