What is the database structure for storing multiple user reviews for single topic?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yateesh
    New Member
    • Dec 2012
    • 36

    What is the database structure for storing multiple user reviews for single topic?

    I need to know the table structure for storing multiple user reviews for single post . Like , there are lists of hotels . Each user can write his review about that hotel . How do i design the database ?

    My table for storing hotel names :

    id title date
    1 Hotel 1 11-01-2012
    2 Hotel 2 12-01-2012

    What should be the table for storing reviews for each hotels by each user ?

    Would appreciate your ideas .
  • Anas Mosaad
    New Member
    • Jan 2013
    • 185

    #2
    You may use a table (i.e. user_reviews) that has foreign two foreign key pointing to the users and hotels tables and include all other tables you want to include.
    For example,
    Reviews (user_id, hotel_id, rating, review_text)
    You may use (user_id, hotel_id) as a composite P.K.

    Comment

    • yateesh
      New Member
      • Dec 2012
      • 36

      #3
      @Anas Mosaad
      Thanks .

      Comment

      Working...