Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,255
Total Threads: 81,199
Total Posts: 566,929
There are 367 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

MySQL: Storing different types of data in 1 column

Thread title: MySQL: Storing different types of data in 1 column
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
10-07-2012, 01:57 AM
#1
Dan is offline Dan
Dan's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 3,164
iTrader: 15 / 86%
 

Dan is an unknown quantity at this point

  Old  MySQL: Storing different types of data in 1 column



The measurement column's data varies. Some measurements will be strict numbers (time, distance, reps, weight - converted to seconds, cm's, lbs.)

I'm at a crossroad with how I store an exercise that's measurement is both weight and reps. I could do something like "60 20" for 60 lb 20 reps. However querying for that data might become a burden if I cannot keep the column as int (would have to change for varchar I figure.)

Would it be best to add more columns to each exercise:

id | userid | exerciseid | date | notes | time | weight | distance | reps

Or am I good with having just the single column to contain all the data? If it were separated into many I'd have loads of NULL values.

I would eventually be pulling the numbers to create graphs. If I could query them correctly I can take the burden off PHP.

What would you do?

     


Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed