8.3.4-mysql enumeration,

Source: Internet
Author: User

Enumeration types and collection types

The value of a field can be selected only in a given range, such as a radio box, a multi-marquee

The enum radio can only select a value within a given range, such as gender sex sex male male/female female

Set multiple selection You can select one or more values within a given range (hobby 1, hobby 2, hobby 3 ...) )

CREATE TABLE consumer (IDint, nameChar( -), Sexenum('male','female'), levelenum('Vip1','VIP2','VIP3'), HobbiesSet('Play','Music','Run') ; insert into consumer values (1,'CMZ','male','Vip1','Music,run'); # because it's not within the selection, insert into consumer values (2,'CMZ','XXX','Vip1','Music,run');
# operation Process MySQL>CREATE TABLE consumer (Idint,    NameChar( -),     Sexenum('male','female'),    Levelenum('Vip1','VIP2','VIP3'),    HobbiesSet('Play','Music','Run')    - ); Query OK,0Rows Affected (0.03sec) MySQL>INSERT into consumer values(1,'CMZ','male','Vip1','Music,run'); Query OK,1Row affected (0.04sec) MySQL>Select* fromconsumer;+------+------+------+-------+-----------+| ID | name | sex | Level | Hobbies |+------+------+------+-------+-----------+|1| CMZ | Male | Vip1 | Music,run |+------+------+------+-------+-----------+1Rowinch Set(0.00sec) MySQL>INSERT into consumer values(1,'CMZ','XXX','Vip1','Music,run'); ERROR1265(01000): Data truncated forColumn'Sex'At row1

8.3.4-mysql enumeration,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.