dongtong0796 2015-05-11 09:35
浏览 30

MySQL中的遗传或外键关联多个表?

Expose my problem, I have two different tables 'user' and 'client'. I want to start storing each session attempt to statistical control. Table 'login_attempts' contains just who does the login, on what date and time and from that IP.

The problem is to relate the 'login_attempts' to 'user' and 'client' at a time to avoid creating a table 'login_attempts' for each entity table.

The problem is not the relationship itself, but that table discriminate both the stored identifier belongs.

I had thought about doing something like:

EER

Table 'login_attempts' would store the identifier of the entity and also the particular register of the entity that performs at logon. In turn, each record of each entity would have a field that would store the identifier of the entity to which belongs (registered in another table) in order to discriminate between one or the other.

I do not know if there is a simpler way to do it and avoid data redundancy.

I do not know if I have explained well. Any help is good, thank you all.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 这种微信登录授权 谁可以做啊
    • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
    • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
    • ¥15 网络设备配置与管理这个该怎么弄
    • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来