dos49618 2016-04-02 17:48
浏览 28
已采纳

用于发货路线的MySQL数据库架构,避免了复杂性[关闭]

I'm trying to build a MySQL schema for the following situation.

A book is being delivered from a locationA to locationB, through several other locations. e.g. For a book delivered from Vancouver to Los Angeles, we can go from Vancouver to Seattle to Portland to Los Angeles (Route 1), or alternatively it can take a different route from Vancouver to Calgary to Blaine to Seattle to Los Angeles (Route 2).

For every book delivered

  • I'd like to keep track of the locations it passed through.
  • I'd like to keep track of whether the book arrived at each location "on-time" or "late".

Later, when I pull up information about a given book, it's going to show the shipping route it took. Similarly, I'd be able to pull up books that were shipped through Calgary (or any other location). Also, I'd be able to show alternative shipping routes that were taken by multiple copies of the same book.

Already, a MySQL schema for this is beginning to sound very convoluted. I understand that with the proper use of foreign-keys and join-operations, we can make something work out.

However, I'm wondering whether the community can recommend a better way to organize this information. Is MySQL well-suited for this job? Should I just try to store this information on external XML files? Or should I explore a NoSQL approach? Comments would be very welcome.

  • 写回答

1条回答 默认 最新

  • dongquanjie9328 2016-04-02 20:31
    关注

    for noSql solution document structure/schema could look like:

    {
      _id:shippingIdHere,
      book:{document containing book data}
      routeInfo:[ {cityId(or just name), timeStamp, isOnTime}]
    }
    

    The document will contain an array of route info data - city, time, and indicator of on time route. Then there will be a need to add an index on routeInfo fields to get what's needed faster.

    I see no issues with MySQL as this can be done by creating a table like this

    rowID|shipingId|bookId|cityId|isOnTime|timeStamp

    and making a view will do the job.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 outlook无法配置成功
  • ¥15 Pwm双极模式H桥驱动控制电机
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换