I have a very simple textbox in a front end application (like php although the language doesn’t matter) and is inserting into the description column in a table in the Database defined below:
Table (ID[primary key], description[varchar(255)])
Although it will not happen often, at times there will be a need to insert more than 255 characters for one tuple. I could increase the length of the varchar but there are restrictions for the tuple size so to play it safe kept it at the recommended maximum 255.
The only way I could figure out how to do this would be to have 2 tables and split the text up into 255 character pieces. Tables defined as:
Table1 (ID[primary key]……….)
Table2 (ID, table1ID[foreign key to table 1] description[varchar(255)])
Is there a better way to achieve this?
Edit: Mysql version 5.5.11
Wasn’t aware there was a text data type. Probably new. Sounds like a type of application object but is it flexible enough to on average store 150 characters and 10% of the times store close to 5000 characters?
If using MySQL version 5.0.3 or later, you can just increase the size of your
VARCHAR. According to the manual:To do this you would do:
Or you could use the
TEXTtype: