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

  • Home
  • SEARCH
  • 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 7614551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:25:55+00:00 2026-05-31T02:25:55+00:00

I need some advice… I have an application where users can do certain actions.

  • 0

I need some advice…
I have an application where users can do certain actions.
For example, users can have friends.
So…
Users can see his friends activity.
So how should I implement the activity log in the DB?
Should I have a new table?
Can I do some queries from multiple table and sort a joined result?

  • 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-05-31T02:25:56+00:00Added an answer on May 31, 2026 at 2:25 am

    I suggest you create an activity_type table and a logs table.

    activity_type | id | name           | table
    --------------+----+----------------+-------
                     1 | added friend   | tbl_users
                     2 | added comment  | tbl_comments
                     3 | added image    | tbl_images
                     4 | Updated dp     | NULL
    

    Now you can easily maintain logs using the following table

       logs_table | id | user | activity_type  | object_id | time_stamp
    --------------+----+------+----------------+-----------+------------
                     1 | 15   | 1              | 5         | 2012-03-10 08:45:05
                     2 | 15   | 2              | 19        | 2012-03-10 08:46:05
                     3 | 15   | 3              | 84        | 2012-03-10 08:47:05
                     4 | 15   | 4              | NULL      | 2012-03-10 08:48:05
    

    User#15 added a new friend user#5 on 10th March.

    User#15 added a new comment#19 on 10th March.

    User#15 added a new image#84 on 10th March.

    User#15 changed his display picture on 10th March.

    UPDATE
    There may be activities where object_id doesn’t make sense like- updated display image, updated profile info etc. Here you can possibly store diff of text in a separate column.

    The same approach can be used for storing audit logs.

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

Sidebar

Related Questions

I need some advice here, I hope somebody can help me. I have the
I need some advice as to how I easily can separate test runs for
I need some advice in creating and ordering indexes in mongo. I have a
Experts - I need some advice in the following scenario. I have a configuration
I need some advice in tackling a query. I can handle this in a
I need some advice. I have a web page and want to extend it's
I need some advice on creating a syntax highligher for java application using swing.
I need some advice on where to start in profiling a silverlight 3 application
I need some advice on a DB I'm working in. I have the DB,
I need some advice with the Java Print API. I have a program that

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.