Jump to content

Superkeys and normalization


pthurmond

Recommended Posts

I have a database that in a few areas saves a list of activities in one field of comma separated numbers. These numbers are activity id numbers that refer to another table. Anyways I know this is bad and I need to rectify it, but I am not sure how. A friend of mine told me I could use superkeys, but he didn't explain them very well and so far I have been able to fine very little on the internet about them. What are they and how exactly to I use and implement them? I am using a MySQL db of course.

Also one of the tables that has this list field is a table of events and each event can have multiple activities. Once I normalize this db can I still keep it down to 1 record per event, or will the event info have to be repeated over and over again? I cannot have a bunch of activities as fields because the list of activities is sure to change over time, so it needs to be dynamic.

Thanks for your time,
Patrick
Link to comment
Share on other sites

a superkey is a single column or a group of columns that can identify a single row. A superkey is referenced in the database structure, used mostly in the design stages of the database development. So when someone talks about a superkey, they might be talking about how they need to design their key structure, or better said their database relationships. compound keys and candidate key are used in the design phase, where you group columns from each table and decide what column will be the primary key or maybe the alternate key for cross/inner joining and the foreign key relating to the primary key or the alternate key in a table relationship.

That why the database structure is so very important, because without good relations you will have already lost the battle. Other things are very important to, like not using standard column types for the data you are storing or creating a index that will never be used. There are many other things that make up terrible database designs, so many that I would need to write a book to explain them to you. So if you need a database that can live in hostile environment and don't know what your doing, then it would be wise to higher a database consultant that can really give you the best optimized table structures that can handle just about anything.


printf
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.