mysqltextsql-types

I want to make db with text type column. but length is always 0 . in mysql


I make db table in mysql.

create table finaltest1(id int(10),title text(20), category text(20), price text(10), ymd text(15), iconurl text(50), screenshoturl text(150), appid text(15), company text(30), capacity text(15));

but text column's length is all 0. Why?


Solution

  • As swati has already said, you need to learn the MySQL String Data Types. If you use TinyText, the column will always take up 256 bytes, even if it's empty. You should note that with the *Text column types you cannot have default values.

    If you use a VARCHAR(20) column, the actual data space used depends on the contents, and you can have defaults.