{"id":296,"date":"2021-11-22T08:52:07","date_gmt":"2021-11-22T08:52:07","guid":{"rendered":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/?p=296"},"modified":"2021-11-22T08:52:07","modified_gmt":"2021-11-22T08:52:07","slug":"the-text-data-types","status":"publish","type":"post","link":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2021\/11\/22\/the-text-data-types\/","title":{"rendered":"The TEXT data types"},"content":{"rendered":"\n<p>Character data can also be stored in one of the set of TEXT fields. The differences between these fields and VARCHAR fields are small:<\/p>\n\n\n\n<ul><li>Prior to version 5.0.3, MySQL would remove leading and trailing spaces from VARCHAR fields.<\/li><li>TEXT fields cannot have default values.<\/li><\/ul>\n\n\n\n<ul><li>MySQL indexes only the first n characters of a TEXT column (you specify n when you create the index).<\/li><\/ul>\n\n\n\n<p>What this means is that VARCHAR is the better and faster data type to use if you need to search the entire contents of a field. If you will never search more than a certain number of leading characters in a field, you should probably use a TEXT data type. <\/p>\n\n\n\n<ul><li>TINYTEXT(n) Up to n (&lt;= 255) Treated as a string with a character set<\/li><li>TEXT(n) Up to n (&lt;= 65535) Treated as a string with a character set<\/li><li>MEDIUMTEXT(n) Up to n (&lt;= 1.67e+7) Treated as a string with a character set<\/li><li>LONGTEXT(n) Up to n (&lt;= 4.29e+9) Treated as a string with a character set<\/li><\/ul>\n\n\n\n<p>The data types that have smaller maximums are also more efficient; therefore, you should use the one with the smallest maximum that you know is enough for any string you will be storing in the field.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Character data can also be stored in one of the set of TEXT fields. The differences between these fields and VARCHAR fields are small: Prior to version 5.0.3, MySQL would remove leading and trailing spaces from VARCHAR fields. TEXT fields cannot have default values. MySQL indexes only the first n characters of a TEXT column &hellip; <a href=\"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2021\/11\/22\/the-text-data-types\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">The TEXT data types<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/296"}],"collection":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=296"}],"version-history":[{"count":1,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/296\/revisions"}],"predecessor-version":[{"id":297,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/296\/revisions\/297"}],"wp:attachment":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}