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 4048524
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:49:40+00:00 2026-05-20T13:49:40+00:00

The main pieces of data I’m having my users enter is an object called

  • 0

The main pieces of data I’m having my users enter is an object called an “activity” which consists of a few text fields, a few strings, etc. One of the text fields, called a “Description”, could possibly be quite long (such as a long blog post). For each user I would like to store all of their activity objects in a mysql database.

Here are some solutions I’ve thought of:

  • Have a separate mysql table for each user’s activities, i.e. activities_userX, X ranging over

  • Use json to encode these objects into strings and store them as a column in the main table

  • Have one separate table for all these activities objects, and just index them; then for each user in the main table have a list of indices corresponding to which activities are theirs.

What are the pros/cons of these methods? More importantly, what else could I be doing?

Thanks.

  • 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-20T13:49:41+00:00Added an answer on May 20, 2026 at 1:49 pm

    Have a separate mysql table for each user’s activities, i.e. activities_userX, X ranging over

    A table for every user? That just means an insane number of tables.

    Use json to encode these objects into strings and store them as a column in the main table

    JSON is a good transport language. You have a database for storing your data, use its features.

    Have one separate table for all these activities objects, and just index them; then for each user in the main table have a list of indices corresponding to which activities are theirs.

    Getting closer.

    This sort of relationship is usually known as ‘has many’. In this case “A user has many activities”.

    You should have a table of users and a table of activities.

    One of the columns of the activities table should be a foreign key that points to the primary key of the user table.

    Then you will be able to do:

    SELECT fields, i, want from activities WHERE userid=?
    

    Or

    SELECT users.foo, users.bar, activities.description from users,activities 
        WHERE user.userid=activities.userid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object of which I am looking to get a piece of
I am trying to create an array, with the data coming from a text
I have written an application which is using NHibernate to provide the underlying object
I have a function that, when called, takes a struct Pieces* field from a
I am writing an in-house application that holds several pieces of text information as
I was wondering for a few ways to accomplish abstracting the data storage access
Imagine we have a piece of code which cuts the large data into smaller
I have a main select list of courses which drives various things on a
I have the following code int main() { cout << Please enter your name...
Please see this piece of code: #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { int i

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.