枚举(“是”,“否”)与TINYINT - 使用哪一个? [英] enum('yes', 'no') vs tinyint -- which one to use?
本文介绍了枚举(“是”,“否”)与TINYINT - 使用哪一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是最好的做法持有真/假值的字段?
What's the best practice for fields that hold true/false values?
这种列可以定义为枚举(是,否),或作为TINYINT(1)。比另一种更好/更快?
Such columns can be defined as enum('yes','no') or as tinyint(1). Is one better/faster than the other?
是更好地利用枚举(1,0)对枚举(是,否)(即,它写是或否作为一个字符串每一行如此数据库的存储容量变大)?
Is it better to use enum('1','0') vs. enum('yes','no') (i.e., does it write 'yes' or 'no' as a string to every row so the database storage size gets bigger)?
推荐答案
此外, ENUM
是非标准MySQL扩展。你应该避免的,特别是如果你可以在一个标准的方式达到同样的效果。
Also, ENUM
is a non-standard MySql extension. You should avoid it, especially if you can achieve the same results in a standard way.
这篇关于枚举(“是”,“否”)与TINYINT - 使用哪一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文