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

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

问题描述

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

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

  • 访问该字段的数值模式,分配不在里面st值不一定会导致错误,而是分配一个特殊的错误值,数值为0,数值为0。

  • 赋值可以通过值字符串或索引号

  • 这样:<$应该避免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天全站免登陆