我是否过度设计了MySQL数据库(用户/公司/产品)? [英] Did I overdesign my MySQL database (users/companies/products)?
问题描述
我是数据库设计的新手, 请给我一些建议.
I'm new to database design, please give me advice about this.
我不确定索引有什么作用,但是 我知道我们应该把它放到什么时候 将像WHERE一样重载 已验证= 1,且搜索类似 company.name =某物.我说的对吗?
im not sure what does index does, but i do know we should put it when it will be heavly loaded like for WHERE verified = 1 and in search like company.name = something. am i right ?
够了吗?
3 数据库规范化
就对吗?
谢谢.
编辑*
规则.
- 每个用户(公司成员或所有者)可以是 公司
- 每个公司都有一些用户.
- 有公司管理员(首席执行官,管理员)和公司成员 (插入产品)
- 每个公司都可以有产品.
- each users( company member or owners ) could be a member of a company
- each company have some member of users.
- there are company admins ( ceo, admins) and there are company members ( inserts the products )
- each company can have products.
对于数字3,我将在users_company处添加一点 -1用于管理员 -0代表会员
for the number 3 i will add a bit at users_company - 1 is for admin - 0 is for members
推荐答案
至少对我来说很好,很规范.
Looks good, well normalised, to me at least.
我注意到每种产品只能属于一个公司.如果那是您的预期,那还好,否则您可以让产品拥有自己的PID并具有product_company关系表,该表可以让多个公司销售特定产品.取决于谁管理我猜的产品.
I notice that each product can only belong to one company. If that's what you intended that's fine, otherwise you could have product have its own PID and have a product_company relation table, which would let more than one company sell a particular product. Depends who administers the products I guess.
我确实注意到,用户表称为用户"(复数),其他表则为单数(公司",产品").不过那只是小事.
I did notice that the user table is called 'users' (plural) and the others are singular ('company', 'product'). That's only a minor thing though.
这篇关于我是否过度设计了MySQL数据库(用户/公司/产品)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!