Which is the correct text datatype to use in MySQL? -


there's varchar, char, text, bigtext, blob...

which correct datatype use when storing small text fields (ie. first_name)?

"correct" strong word, people use varchar. char option, it's not used in experience. this page explains difference.

one of notable differences between char , varchar in latest versions of mysql char incapable of storing trailing spaces (because column automatically padded max length spaces). if store 'abc ', retrieved 'abc'. might not matter applications, it's keep in mind. similarly, prior 5.03, trailing whitespaces stripped varchar fields before insertion. if need store arbitrary byte values , don't want worry different behaviors between mysql versions, should use 1 of blob types.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -