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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:37:06+00:00 2026-05-19T22:37:06+00:00

Say I have several registered users in my website. Users are saved on a

  • 0

Say I have several registered users in my website.

Users are saved on a single table ‘users’ that assigns a unique id for each one of them.

I want to allow my users to track their expenses, miles driven, temperature, etc.

I can’t be sure each user will always enter a value for all trackable variables when they login — so an example of what could happen would be:

'example data'
user     date         amount    miles     temp    etc
1        3/1/2010     $10.00    5         54
2        3/1/2010     $20.00    15          
1        3/12/2010              5         55
1        3/15/2010    $10.00    25        51
3        3/20/2010                        45
3        4/12/2010    $20.00    10        54

What is the best way to set up my tables for this situation?

Should I create a table exclusive to each user when they register? (could end up with thousands of user-exclusive tables)

'user-1 table'
date         amount    miles     temp    etc
3/1/2010     $10.00    5         54
3/12/2010              5         55
3/15/2010    $10.00    25        51

'user-3 table'
date         amount    miles     temp    etc
3/20/2010                        45
4/12/2010    $20.00    10        54

and so on...

Should I create a single table that is essentially the same as the example data above? (could end up with a gigantic table that needs to be combed to find rows with requested user id’s).

'user data table'
user     date         amount    miles     temp    etc
1        3/1/2010     $10.00    5         54
2        3/1/2010     $20.00    15          
1        3/12/2010              5         55
1        3/15/2010    $10.00    25        51
3        3/20/2010                        45
3        4/12/2010    $20.00    10        54

Any suggestions?

  • 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-19T22:37:07+00:00Added an answer on May 19, 2026 at 10:37 pm

    Databases are built to handle similar data as a set together.

    What you want is a single user-data-table, with multiple users in the same table split by user_id. You might want to further normalize that though, so that it stores:

    user     date         type      units
    1        3/1/2010     dollars   10.00
    1        3/1/2010     miles     5
    1        3/1/2010     temp      54
    2        3/1/2010     dollars   20.00
    2        3/1/2010     miles     15          
    1        3/12/2010    miles     5
    1        3/12/2010    temp      55
    etc
    

    Or even further if the user+date makes a specific trip

    trip-table
    tripid    user     date
    ========= ======== =========
    1         1        3/1/2010
    
    type-table
    typeid    description
    ========= ============
    1         dollars
    2         miles
    etc
    
    trip-data
    tripid     type      units
    =========  ========  =======
    1          1         10.00
    1          2         5
    etc
    

    However, if you will always (or almost always) show your data in the form as entered, with the data pivoted on all the input columns (like a spreadsheet), then you would be better off sticking to the un-normalised form for brevity, programmability and performance.

    could end up with a gigantic table that needs to be combed to find rows with requested user id’s

    Assuming you employ indexes properly and judiciously, modern RDBMS are built to handle gigantic amounts of data. The indexes allow the queries to seek only the data it needs, so there is normally little penalty in keeping it all in one table.

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

Sidebar

Related Questions

Say I have several .NET assemblies and want to sign each of them with
I have several users say: A,B,C,D, etc. and 2 group: master, slave. Each user
Say you have several webparts, one as a controller and several which take information
I have heard several podcasters (most recently the guys on DotNetRocks ) say that
Let's say we have a grails web application exposing several resources. tags urls users
Say I have several objects within a class, each of which needs constructing with
Let's say we have several exception classes that extends exception. My question is, in
Let's say you have several models that contain fields for address, postal code, province/country,
Say I have several .otf and .dfont font files that are used in PSD
Say I have a JSON url that returns: Results Users Samus Aran Ridley WorkOrders

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.