哪些数据库系统支持ENUM数据类型,哪些不? [英] Which database systems support an ENUM data type, which don't?

查看:219
本文介绍了哪些数据库系统支持ENUM数据类型,哪些不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

跟进此问题:数据库枚举 - 利弊,我喜欢知道哪些数据库系统支持枚举数据类型,以及一些关于它们如何做的细节(例如,什么是内部存储,什么是限制,查询语法含义,索引影响...)。

Following up this question: "Database enums - pros and cons", I'd like to know which database systems support enumeration data types, and a bit of detail on how they do it (e.g. what is stored internally, what are the limits, query syntax implications, indexing implications, ...).

讨论使用案例或其他问题的利弊。

Discussion of use cases or the pros and cons should take place in the other questions.

推荐答案

我知道MySQL支持ENUM:

I know that MySQL does support ENUM:


  • 数据类型实现为带有关联字符串的整数值

  • 每个枚举最多可包含65.535个元素

  • 每个字符串都有一个数字等值,从1开始,按照

  • 在非严格SQL中,字段的数值可通过 SELECT enum_col + 0

  • 模式中,分配未列表值不一定导致错误,而是分配具有数值0

  • 的特殊错误值以数字顺序发生

  • 赋值可通过值字符串或索引号来实现

  • this:<$应避免使用c $ c> ENUM('0','1','2'),因为'0' 1

  • the data type is implemented as integer value with associated strings
  • you can have a maximum of 65.535 elements for a single enumeration
  • each string has a numerical equivalent, counting from 1, in the order of definition
  • the numerical value of the field is accessible via "SELECT enum_col+0"
  • in non-strict SQL mode, assigning not-in-list values does not necessarily result in an error, but rather a special error value is assigned instead, having the numerical value 0
  • sorting occurs in numerical order (e.g. order of definition), not in alphabetical order of the string equivalents
  • assignment either works via the value string or the index number
  • this: ENUM('0','1','2') should be avoided, because '0' would have integer value 1

这篇关于哪些数据库系统支持ENUM数据类型,哪些不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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