我如何链接一组“执行的服务” mySQL 数据库中的我的员工?
我目前有一个员工数据库,将在我们的网站上显示员工的联系信息。我还有一个包含我们公司提供的所有服务的数据库。每个员工都会提供一项或多项特定服务。我如何才能将每个员工与他们执行的不同服务联系起来?
I currently have an employee database that will display employee contact info on our website. I also have a database of all of the services our company offers. Each employee does one or more of those particular services. How could I link each employee to the different services they perform?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将添加第三个表作为联接表,其中将包含员工和服务表条目的键。每个员工在连接表中可能有几行,具体取决于他们提供的服务数量。
http://en.wikipedia.org/wiki/Junction_table
You would add a third table as a Join table that will contain keys to the employee and service table entries. Each employee may have several rows in the join table depending on the number of services they provide.
http://en.wikipedia.org/wiki/Junction_table
您可以:
然后当您需要某个员工的所有服务时:
或当您需要所有员工的某项服务时:
。
You can:
and then when you need all of the services for an employee:
or when you need to all the employees for a service:
.