简体   繁体   English

一对多在mysql中具有特定编号

[英]one-to-many with specific number in mysql

I'm build Reporting System. 我正在建立报告系统。 This system has 3 admins and each admin has 6 supervisors. 该系统有3个管理员,每个管理员有6位主管。 I know that is one to many relationship but how to specify 1 admin to 6 supervisors in mysql. 我知道这是一对多的关系,但是如何在mysql中指定1位管理员到6位主管。 Thanks 谢谢

You need to apply such constraints in your business logic, MySQL won't give you ability to apply such constraints. 您需要在业务逻辑中应用这样的约束,MySQL不会给您应用这些约束的能力。

If you are specifying supervisors for admin or admin for super visors, max limiting constraint should be implemented from your programming languages, or better yet, implement such logic in store procedures. 如果要为admin指定超级用户或为超级用户指定admin,则应从您的编程语言中实现最大限制约束,或者更好的是,在存储过程中实现此类逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM