Posts tagged: MYSQL

MySQL Group Count

By , February 25, 2012 9:58 AM

clog.Patientseen = ‘1’ AND
clog.AppointmentDate >= ‘2007-12-01’ AND
clog.AppointmentDate <= ‘2007-12-23’ GROUP BY

Char and VARCHAR

By , September 5, 2011 8:34 PM

Where the data varies significantly in length from one record to the next with the longest being significantly longer than the average then you need to use a VARCHAR. There is no point in using a CHAR(40) if the average length is only 15 since that will resuult in a lot of wasted space in most records. Using a VARCHAR(40) instead means that you can still fit the leng 40 chharacter values while the average space used will be 15 plus the record length marker overhead.

summary use varchar for variable length fields and use char if you are expecting it to always be the same eg CHAR (ASSS, DASS, FASS, TASS) this is good for a char ie fixed length fields

Thomas Challenger Thomas Challenger