From: Peter Brawley Date: March 27 2009 2:54pm Subject: Re: Data structure for matching for company data List-Archive: http://lists.mysql.com/mysql/216915 Message-Id: <49CCE8B7.8080008@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------080803070101050403050105" --------------080803070101050403050105 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 > > --------------080803070101050403050105--