【发布时间】:2014-04-03 10:29:23
【问题描述】:
我正在编写一个应用程序来跟踪用户阅读的博客
当前我在数据库中有两张表,一张用于博客可以属于的不同类别,例如技术、音乐、电影等。
Schema of the table is - CATEGORIES (id , name)
id -- > primary key
name -- > string (name of the category)
第二个表存放博客
Schema - BLOGS (id, blog_name, blog_url,category)
id -- > key
category -- > foreign key referencing CATEGORY table
现在我需要设计一个表格来存储用户的信息,例如姓名、电子邮件、密码和他/她阅读的博客列表
问题是一个用户可以点赞任意数量的博客,而一个博客可以被任意数量的用户点赞。
我需要设计用户表,以便特别方便地进行以下查询。
-> given a blog the list of all users that like the blog
-> given a user the list of all blog that user likes
请给我一些有价值的建议
【问题讨论】:
标签: database-design database-schema