Jump to content

Mp3 Shop Tables


tekcap

Recommended Posts

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?

Link to comment
Share on other sites

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...  ;)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.