pthurmond Posted November 18, 2006 Share Posted November 18, 2006 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted November 19, 2006 Share Posted November 19, 2006 Never heard of superkeys -- but you need to make another table with a many-to-many relationship between those two tables. Quote Link to comment Share on other sites More sharing options...
printf Posted November 19, 2006 Share Posted November 19, 2006 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted November 19, 2006 Share Posted November 19, 2006 Oh, a multi-column unique key.... 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.