MySQL 在 phpmyadmin 中仅将几个值设置为要枚举的域
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15028912/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
setting only a few values as domain to enum in phpmyadmin
提问by Prateek Jain
How to set enum values in phpmyadmin..I want to set values '0' or'1' in phpmyadmin for my field using an 'enum' type ..
如何在 phpmyadmin 中设置枚举值..我想在 phpmyadmin 中使用“枚举”类型为我的字段设置值“0”或“1”。
回答by echo_Me
or under your phpmyadmin
或在您的 phpmyadmin 下
choose enum
in
Length/Values
column put there :'0' ,'1'
选择枚举
在
Length/Values
列放在那里:'0' ,'1'
and your done
你完成了
回答by Vasanth
ALTER TABLE `table_name` CHANGE `old_column_name` `new_column_name` ENUM('0','1') DEFAULT NULL
回答by Daroath
It's quite long time for this answer maybe no use for the one who ask this question, but might be useful for those who are new to phpmyadmin. To set a default value for Enum I have the following example. Type= ENUM, Length/Valuesjust put the value inside single quote like 'Male', 'Female' then Defaultchoose As defined:in the box below just type Male without quote. Hope this help!
这个答案已经很长时间了,对于提出这个问题的人来说可能没有用,但对于那些不熟悉 phpmyadmin 的人来说可能有用。要为 Enum 设置默认值,我有以下示例。 Type= ENUM, Length/Values只需将值放在单引号内,如“男”、“女”,然后默认选择“定义”:在下面的框中键入不带引号的男。希望这有帮助!
回答by John Woo
CREATE TABLE tableName
(
enumColumn ENUM('0','1')
);
回答by Aman Attari
Put Length/Values as it is for 0 and 1 '0' ,'1'
将长度/值按原样放置 0 和 1 '0' ,'1'
回答by freakywebix
use GUI of phpmyadmin => by selecting the ENUM in type and then just set the values.
通过在类型中选择 ENUM 来使用 phpmyadmin => 的 GUI,然后只需设置值。