dongzhong2674 2014-09-13 05:03
浏览 47

在MySQL中构建用户数据[关闭]

I'm setting up a new web service, and need some help with organizing the data in my application. My application's written in PHP, and I plan to store all user data in using MySQL Databases.

I will have a bunch of users, and each of those users will have a bunch of data that is tied to their account. It's a note taking application, and so, naturally, for every user, I need to keep track of the number of notes, and the content of each of those notes.

How do I go about structuring this and translating this into MySQL tables? I know I have to do something that revolves around linked (related) tables, but can't seem to pinpoint it.

I have 10x1GB databases.

  • 写回答

2条回答 默认 最新

  • douxian9060 2014-09-13 05:13
    关注

    Have the following tables (you can choose your own names);

    tbl_users
    int(4)       userid (PRIMARY)
    varchar(128) firstname
    varchar(128) lastname
    
    tbl_notes
    int(8)       noteid (PRIMARY)
    int(4)       userid
    text         notecontent
    

    As you can see, userid is the relation between the two tables (1 to many in this case).

    See Database normalization from Wikipedia

    评论

报告相同问题?

悬赏问题

  • ¥15 vue3加ant-design-vue无法渲染出页面
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序