Basic mysql Data Type, mysql Data Type

Source: Internet
Author: User

Basic mysql Data Type, mysql Data Type

Big Data Type

Create table data (fti TINYINT, fsi SMALLINT,

Fmi MEDIUMINT, fi INT, fbi BIGINT );

Int type

Create table data1 (age INT (7 ));

Float Type

Create table data2 (price FLOAT (5, 2 ));

Insert into data2 VALUES (13.1), (14.567 );

Query results: retain the last two decimal places

SELECT * FROM data2;

Char type

Create table data3 (sname CHAR (10 ));

Insert into data3VALUES ('wers'), ('ertdsasdfggh ');

SELECT * FROM data3;

Not enough space to complete, redundant automatic Truncation

Time type:

Create table data4 (birthday DATE );

Insert into data4 VALUES ('2017-03-05 '), (2015 );

SELECT * FROM data4;

Enum type

Create table data5 (gender ENUM ('M', 'F '));

Insert into data5VALUES ('M'), ('M'), ('F'), ('yy'), (NULL );

SELECT * FROM data5;

Select count (*) FROM data5 WHEREgender = 'M ';

Copyright statement: original post of the blogger. For details, refer to the source. Http://blog.csdn.net/dzy21

Related Article

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.