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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:51:08+00:00 2026-05-20T11:51:08+00:00

I am creating an activity table with many types of activities. Let’s say activities

  • 0

I am creating an activity table with many types of activities. Let’s
say activities of type “jogging” will have elements a, b, and c while
activities of “football” will have elements a, d, and e. Can I create a
table in which the row elements for each column depend on that column’s
type? I have considered creating one table for each activity type or
creating a single table with rows for every activity’s options, but
there will be many activity types so it seems like a waste to use so
many tables or leave so many rows blank.

  • 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-20T11:51:09+00:00Added an answer on May 20, 2026 at 11:51 am

    You cannot create such a table, it is not in the nature of databases to allow for “varargs”. That is the reason we have relations in databases to model this type of stuff.

    For an evil quickhack you could store the variable number of arguments in one column in a specific format and parse this again. Something like “a:foo|e:bar|f:qux”. Don’t do this, it will get out of hand in about 1 day.

    I second James’ proposal: redesign your tables. It should then look something like this.

    Table: Activities
    id|activity
    0|jogging
    1|football
    2|...
    
    Table: ElementsOfActivities
    id|activity_id|element
    0|0|a
    1|0|b
    2|0|c
    3|1|a
    4|1|d
    5|1|e
    

    Look up “normalization” (for example http://en.wikipedia.org/wiki/Database_normalization)

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

Sidebar

Related Questions

I have a webview that I'm creating in an Activity which is a child
Let's say there is this table which stores the number of visitors for each
I'm creating android app that has table layout for the main activity, and that
I am creating a Table Layout in one of my activities. On touch of
I'm creating sign_up and sign_in page and data that type into editview will be
I'm creating a new database in my Activity like this: @Override public void onCreate(Bundle
Creating a server-side socket will fail if I'm trying to use the same port
Creating a JApplet I have 2 Text Fields, a button and a Text Area.
When creating a new service in a WCF service project, Visual Studio will automatically
I have a conundrum, I do know how to call method from other activity..

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.