Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting only a few values as domain to enum in phpmyadmin

How to set enum values in phpmyadmin..I want to set values '0' or '1' in phpmyadmin for my field using an 'enum' type ..

like image 680
Prateek Jain Avatar asked Feb 22 '13 16:02

Prateek Jain


People also ask

How do I change the ENUM value in phpmyadmin?

Type "an_enum" in the "Field" edit box. Select "ENUM" from the "Type" drop-down list. Type "'red', 'yellow', 'green'" in the "Length/Values" field. Select "As defined:" from the "Default" drop-down list.

What is the difference between ENUM and set in MySQL?

For ENUM , the value is inserted as the error member ( 0 ). For SET , the value is inserted as given except that any invalid substrings are deleted. For example, 'a,x,b,y' results in a value of 'a,b' .

How do I edit an ENUM in MySQL?

You can add a new value to a column of data type enum using ALTER MODIFY command. If you want the existing value of enum, then you need to manually write the existing enum value at the time of adding a new value to column of data type enum.

What is the correct usage of ENUM in MySQL create table?

The ENUM data type in MySQL is a string object. It allows us to limit the value chosen from a list of permitted values in the column specification at the time of table creation. It is short for enumeration, which means that each column may have one of the specified possible values.


2 Answers

ALTER TABLE `table_name` CHANGE `old_column_name` `new_column_name` ENUM('0','1') DEFAULT NULL 
like image 72
Vasanth Avatar answered Oct 15 '22 03:10

Vasanth


or under your phpmyadmin

  • choose enum

  • in Length/Values column put there : '0' ,'1'

and your done

like image 28
echo_Me Avatar answered Oct 15 '22 03:10

echo_Me