Hi guys..

I'm creating a website for a client and it's a pretty simple online boutique with around 50 products.. Is there a need for foreign keys as i havent learned how to use foreign keys properly.
I cant seem to figure out why will I do them since all the products and info are one.

Thanks

It's my first time doing freelance 🙂 hope it goes well.

    In short, yes, you should define primary-foreign key relationships in your database. They allow for maintaining the referential integrity of your database design, as well as provide some data manipulations advantages such as defining 'on-delete-cascade' triggers.

      Strictly speaking, they are not necessary. Without them, you'll probably have to write a good bit of extra code to keep your tables clean. Plenty of software projects never bother with them (osCommerce, phpbb, PHPList, etc.).

        Thanks guys.. Think I'll give foreign keys a miss on this one. I will read up on it though!

          Write a Reply...