tekcap Posted March 21, 2007 Share Posted March 21, 2007 Hello, I have a few more questions about my digital MP3 Shop's Tables, located here. http://img156.imageshack.us/my.php?image=erdom0.jpg First of all, in my Purchase Table I Have a Column called E-Mail. Whenever a user makes a purchase certain information(E-Mail) is recorded in the Purchase Table. Now do I really need an E-Mail Column In the purchase Table? Or can The E-Mail be fetched From The User Table Directly since User ID is a foreign key In the Purchase Table? If this is possible is it dangerous? Can It cause Data Redundencies? Basically what im scared of is down the road when a User changes E-mail or Adress, or I change a song price, the records wont show the OLD E-Mail Or Price but the new UPDATED one. This is BAD because at the time the song might have been cheaper. Does anyone follow what I mean here? Quote Link to comment Share on other sites More sharing options...
phpfan Posted March 21, 2007 Share Posted March 21, 2007 Hi When you have a foreign key linking two tables there is no need to store the same value twice because you can retrieve it or use it by using JOIN in the sql query... so there is no need to store the email twice.. I think you should see how normalization works... http://en.wikipedia.org/wiki/Database_normalization I am not sure if i was very helpful since i am new in php and Mysql so you should hear and some other opinions... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.