I've done a lot of reading on normalization, but I'm having a hard time grasping some of the concepts.
Especially how to use foreign keys and junction tables.
Let's say I have a DB where I keep track of bicycles. I have a table, 'tblBikeInfo' with a lot of fields containing info about each specific bike, which I'm trying to separate into multiple tables.
As it is, I have a string field named 'BikeType' in my table and I'm restricting the textbox input to 'Male', 'Female' or 'Unisex'. If I normalize the DB, I'll end up with 1 or 2 extra tables. Will that not demand more resources from the server?
I don't mind putting in the work to do it right, I just want to be sure which path is the correct one before starting.
1. Properties with n:1 relations, like brand, size or, ie., color.
Is it best practice to make another table with colorID and colorName, keep the field in 'tblBikeInfo'and have the colorID as a FK, or would you remove the field from 'tblBikeInfo' and make a junction table, containing the bikeID and the colorID
Can anyone provide a brief overview of the differences between the two methods and when to use which one?
2. What about booleans, like a checkbox indicating if the bike is electric or not.
Is there any need for separating such properties into separate tables?
Thank you all in advance for any advice, tips and/or helpful comments.
JJ
Especially how to use foreign keys and junction tables.
Let's say I have a DB where I keep track of bicycles. I have a table, 'tblBikeInfo' with a lot of fields containing info about each specific bike, which I'm trying to separate into multiple tables.
As it is, I have a string field named 'BikeType' in my table and I'm restricting the textbox input to 'Male', 'Female' or 'Unisex'. If I normalize the DB, I'll end up with 1 or 2 extra tables. Will that not demand more resources from the server?
I don't mind putting in the work to do it right, I just want to be sure which path is the correct one before starting.
1. Properties with n:1 relations, like brand, size or, ie., color.
Is it best practice to make another table with colorID and colorName, keep the field in 'tblBikeInfo'and have the colorID as a FK, or would you remove the field from 'tblBikeInfo' and make a junction table, containing the bikeID and the colorID
Can anyone provide a brief overview of the differences between the two methods and when to use which one?
2. What about booleans, like a checkbox indicating if the bike is electric or not.
Is there any need for separating such properties into separate tables?
Thank you all in advance for any advice, tips and/or helpful comments.
JJ