D
D
Danil2015-12-28 17:31:18
MySQL
Danil, 2015-12-28 17:31:18

What datatype to use in mysql?

In general, there is a field where data up to 2000 characters long can be entered. What type of data to use for storage? It is also fundamentally important to be able to set a default value (which does not work in text fields for some reason).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander N++, 2015-12-29
@Veneomin

Every table (regardless of storage engine) has a maximum row size of 65,535 bytes. Storage engines may place additional constraints on this limit, reducing the effective maximum row size.

According to the link, everything quite reaching is explained dev.mysql.com/doc/refman/5.7/en/column-count-limit.html
If briefly, the total number of field types should not exceed 64kb.
Text + blob field types are not taken into account
. In your case, you need to use TEXT BLOB for text
. The default value can be set at the code level.

P
Peter, 2015-12-28
@petermzg

The VARCHAR type can be up to 65,535 in length as of version 5.0.3.
And when creating a table, the default value is normally set
City VARCHAR(40) NOT NULL DEFAULT 'Unknown'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question