Home > Database > Mysql Tutorial > mysql基本数据类型_MySQL

mysql基本数据类型_MySQL

WBOY
Release: 2016-06-01 12:58:53
Original
1441 people have browsed it

大数据类型

CREATE TABLE DATA(fti TINYINT,fsi SMALLINT,

fmi MEDIUMINT,fi INT,fbi BIGINT);

int类型

CREATE TABLE data1(age INT(7));

float类型

CREATE TABLE data2(price FLOAT(5,2));

INSERT INTO data2 VALUES(13.1),(14.567);

查询结果:保留小数点后两位

SELECT * FROM data2;

char类型

CREATE TABLE data3(sname CHAR(10));

INSERT INTO data3VALUES('wers'),('ertdsasdfggh');

SELECT * FROM data3;

不够空格补齐,多余自动截取

时间类型:

CREATE TABLE data4(birthday DATE);

INSERT INTO data4 VALUES('2015-03-05'),(20150506);

SELECT * FROM data4;

enum类型

CREATE TABLE data5 (gender ENUM('M','F'));

INSERT INTO data5VALUES('M'),('m'),('f'),('yy'),(NULL);

SELECT * FROM data5;

SELECT COUNT(*) FROM data5 WHEREgender='M';

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template