dtgj8529 2012-03-04 05:43
浏览 39

社交网站数据库开发[关闭]

How to manage social network site database perfectly?

I recently start building a social network site database below is my concept of database

Is this is correct or you suggests something else and why

1."user" table stores user details

2."posts" tables stores posts of all user with the user unique id

3."likes" table stores the likes of each posts separately with user, post and comment unique id

4."friends" tables stores the 50001 user ids one id of user and 5000 ids of his/er friends in separate column means 5001 fields is it ok ?

5."comments" table stores comment of all posts which uniques ids of user, post and comment

and all table loads some data on profile.php where user can able to post, like, comment

here is the things which profile.php file do on load

  1. Shows post input box with submit button
  2. Shows 10 posts in iframe
  3. calculate and show likes, comments on each post

Is this is ok to count the total likes and comments default on any post? and when user click on likes or comments than show him/er the list of peoples who's likes or comments on his/er post? is the above type of database handle this query ? and whats the speed of this process fast/normal/slow ? and "select" command is enough and work fine for this query? Note: I use PHP, MySQL and JavaScript

Please accept my apologize for low formatting and weak English but i try my best

Thank you so much

  • 写回答

1条回答 默认 最新

  • dongxuanchao1425 2012-03-04 06:41
    关注

    Seams more or less on target (though a very naive approach) with just a single big NO! on the user friends table.

    userId | friendId
    

    Should be the friends table. Just that. When you want to look for user with ID 24 friends you do a

    SELECT friendId from user_friends_table WHERE userId = 24
    

    Aside from it start it. The only real way for you to acknowledge how you should have implemented it is to try and fail. Over and over again.

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b