Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Shon Levi
Shon Levi
6,036 Points

How much type size limit to defined?

I want to build some SQL database, but I don't know how much size limit to put...

If I need to make TEXT data type column for article code, I don't know how much charcters I will need... it can be 500, 1000 and even 6000

There is some way to not defined size limit to data types like VARCHAR / TEXT / ETC...?

4 Answers

Sorry, missed it. I just tested this in my mySQL database, and it allowed me to add a field with a data type of TEXT without putting in any value for length. So no, you don't need a length. But you also don't want to enter TEXT(), just TEXT.

TINYTEXT is a string data type that can store up to to 255 characters. TEXT is a string data type that can store up to 65,535 characters. TEXT is commonly used for storing blocks of text used for brief articles. LONGTEXT is a string data type with a maximum length of 4,294,967,295 characters.

For VARCHAR you specify the size up to 65,535.

Here's a link to a mySQL forum post on TEXT vs VARCHAR: http://forums.mysql.com/read.php?24,105964

Shon Levi
Shon Levi
6,036 Points

My question is how can I leave it open like that: articletext TEXT();

this give me an error - that I must enter the limit size of charcter...

Shon Levi
Shon Levi
6,036 Points

Got it! Thanks alot! :)