drm16022 2010-07-30 18:22
浏览 23

如何在mysql和php中一次链接大量项目?

For example:

There are 10,000 items in a list and the user needs to be able to select a portion of these based on whatever criteria, and then put them into a group. So as the user, I filter the list of these 10,000 items based on whatever, hit select all and then click "Group".

I'm trying to come up with the most efficient method of linking these all together.

If I have item_table and group_table and then group_has_item, I'd effectively have to INSERT 1,000 rows at one time into the group_has_item table. Is there an efficient way to do this? Or is there a better schema? The only requirement is that these items have to be able to be tied to multiple groups at once.

  • 写回答

1条回答 默认 最新

  • douchuoliu4422 2010-07-30 18:25
    关注

    If I have item_table and group_table and then group_has_item, I'd effectively have to INSERT 1,000 rows at one time into the group_has_item table. Is there an efficient way to do this?

    Yes - what you describe is the proper way to associate the records.
    It's called a many-to-many relationship, and uses a table for holding these relationships. Some call the table linking the two entities map, lookup, xref... I've forgotten some of the synonyms.

    评论

报告相同问题?

悬赏问题

  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了