Home > Backend Development > PHP Tutorial > 这个数据库结构怎么设计?

这个数据库结构怎么设计?

WBOY
Release: 2016-06-06 20:42:28
Original
844 people have browsed it

<code>language:
+----------+------------------+
| Field    | Type             |
+----------+------------------+
| id       | int(10) unsigned |
| language | varchar(45)      |
+----------+------------------+

country:

+-------+------------------+
| Field | Type             |
+-------+------------------+
| id    | int(10) unsigned |
| name  | varchar(45)      |
+-------+------------------+

goods:
+--------------+------------------------+
| Field        | Type                   |
+--------------+------------------------+
| id           | int(10) unsigned       |
| name         | varchar(200)           |
| model        | varchar(45)            |
| description  | varchar(200)           |
| price        | decimal(10,2) unsigned |
+--------------+------------------------+
</code>
Copy after login
Copy after login

需求:
1、有1人做商品信息录入[基本信息]
2、A、B、C 国家进行信息本地化,包括name,description,price等。model 是 unique 的,不用本地化。
3、D 国家发现语言和基本信息一致,不用进行本地化,此时读取[基本信息]。
4、E 国家可只本地化价格,其他信息按照[基础信息]来显示。

回复内容:

<code>language:
+----------+------------------+
| Field    | Type             |
+----------+------------------+
| id       | int(10) unsigned |
| language | varchar(45)      |
+----------+------------------+

country:

+-------+------------------+
| Field | Type             |
+-------+------------------+
| id    | int(10) unsigned |
| name  | varchar(45)      |
+-------+------------------+

goods:
+--------------+------------------------+
| Field        | Type                   |
+--------------+------------------------+
| id           | int(10) unsigned       |
| name         | varchar(200)           |
| model        | varchar(45)            |
| description  | varchar(200)           |
| price        | decimal(10,2) unsigned |
+--------------+------------------------+
</code>
Copy after login
Copy after login

需求:
1、有1人做商品信息录入[基本信息]
2、A、B、C 国家进行信息本地化,包括name,description,price等。model 是 unique 的,不用本地化。
3、D 国家发现语言和基本信息一致,不用进行本地化,此时读取[基本信息]。
4、E 国家可只本地化价格,其他信息按照[基础信息]来显示。

加good_fields表(country_id,good_fields)来判断本地化字段
再加一个country_goods表(country_id,goods)来存本地化商品信息

获取good信息需要good_id和country_id
如果觉得冗余太多可以考虑序列化为json存储country_goods表

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template