0

I can find a lot of information about the concepts of normalization, but I don't really see documentation for how to actually bring a table, for example, from first normal form to second normal form. I'm using SQLite through Python to automate some data processing, and I have three input tables that need normalized before I can accurately work wih them. I can do some cut/paste in Excel but this is time consuming. I'm interested to know what I can do once I import a table into a SQLite database to get it into first normal form.

Here's an example table:

P_ID Product Creator Creator_loc
1 Ball Yoyo Atlanta
2 Bat Yoyo Atlanta
3 Shoes Hobbs Dallas
4 Keyboard Hobbs Dallas

To be turned into 2 tables:

P_ID Product Creator
1 Ball Yoyo
2 Bat Yoyo
3 Shoes Hobbs
4 Keyboard Hobbs

C_ID Creator Creator_Loc
1 Yoyo Atlanta
2 Hobbs Dallas

Any help is appreciated. Thanks

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by StephenChristen
0

Your example is already in 1NF which requires that there be no repeated columns in the table. It looks like you are trying to convert it into 2NF but even then your example fails as you repeat data from the first table in the second table.

I'm also not sure what you are looking for. Did you want SQL statements to transfer the data from your first table into a set of normalized tables?

0

Your example is already in 1NF which requires that there be no repeated columns in the table. It looks like you are trying to convert it into 2NF but even then your example fails as you repeat data from the first table in the second table.

I'm also not sure what you are looking for. Did you want SQL statements to transfer the data from your first table into a set of normalized tables?

Yes, end result would be SQL statements. I can create a query to aggregate the info for the Creator_table:

SELECT Creator, Creator_loc
FROM Original_table
GROUP BY Creator

This will give me the 2 creators and their locations. Then what would I do to turn this into a database table with an integer primary key?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.