是否可以将大型MySQL表拆分为较小的相关表?
例如想象表:
x_data--
id | offer_price | offer_text | free_gift | free_gift_category | model_name | model_description | tariff_name | tariff_rental | tariff_minutes | tariff_texts | tariff_data | retailer_name | retailer_description
是否可以将其拆分为单独的表并构建关系,以便生成的表格如下所示:
offers--
id | offer_price | offer_text | free_gift_id | model_id | tariff_id | retailer_id
free_gifts--
id | free_gift | free_gift_category_id
free_gift_categories--
id | free_gift_category
models--
id | name | description
tariffs--
id | name | rental | minutes | texts | data
retailers--
id | name | description
即我可以在子选择或加入时插入吗?
类似的东西:
$query = "INSERT INTO retailers (name,description)
(SELECT retailer_name, retailer_description FROM x_data) as retailer,
(SELECT MAX(id) as retailer_id FROM retailers) as retailer_id,
INSERT INTO tariffs (name, rental, minutes, texts, data) as tariffs, ...."
如果有可能,我该怎么办呢?