Peter Lai thinks you've done a great job on the shopping_db database, but now he wants you to normalize our data, ie split the repetitive parts into their own tables.
- Within
shopping_db, create a table,storesfor holding your store data. Each store should have:
- an auto-incrementing primary key of
id - a
nameattribute - a
sloganattribute
- Create an entry in the
storestable for each of the stores that appears in thereceiptstable, passing in borderline creative dummy data forslogan - Now add a
store_idcolumn to thereceiptstable. - Now update the records in the
receiptstable so that each record gets the appropriatestore_idvalue.
- Example: If
Searsis assigned an id of 3 in the stores array, update all therecieptsfor Sears purchases with astore_idof 3.
- Now drop the
storecolumn in thereceiptstable. It's redundant and less informative than our new data-rich table.