MySQL文本存储? [英] Mysql Text Storage?

查看:95
本文介绍了MySQL文本存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在想,如果您要在哪里放置一篇或多篇文章,那么为文章文本创建数据库结构会更好吗?又为什么呢?

I was wondering if you where to have an article or articles with huge amounts of text, what would be better when creating the database structure for the articles text? And why?

优势或劣势是什么?

我当时正在考虑使用以下一种数据类型来保存MySQL数据库的文章文本.

I was thinking of using one of the data types below to hold the articles text for the MySQL database.

VARCHAR
TEXT
MEDIUMTEXT
LONGTEXT

推荐答案

请查看

Please have a look at the Documentation of MySQL, there're the differences between these types explained.

但是要回答您的问题,VARCHAR是用户定义长度的字段,而Text-Fields具有系统定义的大小:

But to answer your question, VARCHAR is a field of user-defined length, while the Text-Fields have a system-defined size:

  • VarChar [1-whatever(最大65535)]
  • TinyText 255(2 ^ 8-1)
  • 文本65535(2 ^ 16-1)
  • MediumText 16M(2 ^ 24-1)
  • LongText 4G(2 ^ 32-1)

因此,每当我需要小于255的字段时,我都会使用VarChar.

So, I use VarChar whenever I need a field which is smaller then 255.

这篇关于MySQL文本存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆