Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8017069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:43:49+00:00 2026-06-04T20:43:49+00:00

I am developing web application where I have to implement ‘Likes’ system as facebook

  • 0

I am developing web application where I have to implement ‘Likes’ system as facebook has. Application will have a few categories of products that customer can ‘like’. So I have started to create database, but I stuck on one obstacle. As I understand there are two ways of doing this:

First. Create one database table with fields of “id, user_id, item_category, item_id”. When user click ‘like’ button information will be saved in this table with various categories of products (item_category).

Second. Create several tables for certain categories of item. For instance, “tbl_item_category_1, tbl_item_category_2, tbl_item_category_3” with fields of “user_id, item_id”.

Would be great to get more insight about best practices of this kind database structures. Which works faster? and more logical/practical? I will use only several categories of items.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:43:50+00:00Added an answer on June 4, 2026 at 8:43 pm

    I would go with the first version with a table structure similar to this:

    User Table: PK id
    id
    username
    
    Category Table: PK id
    id
    categoryname
    
    Like Table: PK both user_id and catgory_id
    user_id
    category_id
    

    Here is a SQL Fiddle with demo of table structure with two sample queries to give the Total Likes by user and Total Likes by category

    The second one – creating multiple tables is a terrible idea. If you have 50-100 categories trying to query those tables would be horrible. It would become completely unmanageable.

    If you have multiple tables trying to get a the total likes would be:

    Select count(*)
    from category_1
    JOIN category_2
        ON userid = userid
    join category_3
        ON userid = userid
    join .....
    

    Use one table, no question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a web application and I currently have the following ACL assigned to
I am developing a web application, i have following uses of google maps List
I have decided to start developing a little web application in my spare time
I have 5 years of work experience in developing WEB and WIN application using
I have a .NET web application in which I am developing three separate websites
I am developing an ASP.NET web application that incorporates google maps. I have an
Age old question! When you have finished developing and testing your ASP.Net web application,
We will be developing 3 asp.net web applications. Each of them will have it's
I am developing a web application where I have implemented job scheduler using Global.asax.
I have been developing a web application for almost a year which I had

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.