V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
rupert
V2EX  ›  MySQL

请问下怎么设计表? 没有玩过复杂的表设计

  •  
  •   rupert · 2017-02-21 15:38:12 +08:00 · 2851 次点击
    这是一个创建于 2621 天前的主题,其中的信息可能已经有所发展或是发生改变。

    本人 js 背景, 这种数据一般就直接存 MongoDB, 取出来也不麻烦。

    如果是存为 Mysql, 是不是要分为几个表 addressList, history, products, leaders, 用 companyId 关联?

    还有数组应该怎么存合适?比如 addressList, labels, leaders 。

    2 条回复    2017-02-21 17:14:39 +08:00
    bombless
        1
    bombless  
       2017-02-21 15:42:47 +08:00
    就是这样,数组用 companyid 关联
    jian529910670
        2
    jian529910670  
       2017-02-21 17:14:39 +08:00
    数组中 companyId 是一样的话 存 4 条记录 使用 companyId 做业务主键查询
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2657 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 04:42 · PVG 12:42 · LAX 21:42 · JFK 00:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.