Choi,

>I found that I cannot use FK for Myisam tables. Then,
>this kind of data structuring is no use at all for
>Mysiam tables. Is this correct?

You can use this structure with MyISAM tables. It will work fine except you won't have the advantage of database-level enforcement of foreign key constraints--do it with code.

PB

----


ChoiSaehoon wrote:
Thanks, PB.



Date: Fri, 27 Mar 2009 09:54:47 -0500
From: peter.braw...@earthlink.net
To: saeho...@hotmail.com
CC: mysql@lists.mysql.com
Subject: Re: Data structure for matching for company data

Choi

1. company (3 cols) - company id(pk), company name
2. industry (3 cols) - industry id(pk), industry, sub-industry
3. matching table (3 cols?) - match id(pk), company id(fk), industry id(fk)...?
Yes, you've got it. In the matching (usually called "bridging") table, any company or industry can appear multiple times, but no combo can appear more than once.

PB
http://www.artfulsoftware.com

-----

ChoiSaehoon wrote:
I'm a complete newbie, so please feel free to help me here!



I simplified my problem as below:
1. Thousands of companies (i.e. company names)
2. 200 industries. Each company has tree-type(?) industry info. (Industry, 
Sub-industry. Say, each industry has 10 sub-industry information. (10X20))



The problem is one company can have 1,2,3... or 15 industries and/or 
sub-industries... (as in a real-life case)



What would be a smart way create tables for this situation? (both company and 
industry must be searchable)



(One rough thought (after having studying MySQL for 2 weeks now) is create 3 tables of 1. company (3 cols) - company id(pk), company name
2. industry (3 cols) - industry id(pk), industry, sub-industry
3. matching table (3 cols?) - match id(pk), company id(fk), industry id(fk)...? But, 
one company can have more than 1 industry info! Ah... Then, if that's the case, 
different match id & same company id & different industry id??)

I'm stuck here! :(


Any general advice would be appreciated... :)

_________________________________________________________________
???? ???, ???? ?? ???? ???? ??? Windows Live Hotmail! ?? ???? ???!
http://www.hotmail.com

------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.30/2026 - Release Date: 03/27/09 07:13:00



_________________________________________________________________
MSN ???? ??? ??, Windows Live Messenger!
http://windowslive.msn.co.kr/wlm/messenger/
------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.32/2030 - Release Date: 03/30/09 08:40:00

Reply via email to