Home  >  Article  >  Database  >  MySQL 插入数据 date 格式

MySQL 插入数据 date 格式

WBOY
WBOYOriginal
2016-06-07 15:52:572057browse

在MySQL 中 插入数据时, 字符串型值要用双引号或单引号引起来,数值型不用引号(加引号就会报错) 在插入日期date 时 正确的格式是 '0000-00-00' 例如 name (varchar20), age (int 11) , birth(date) 那么插入格式是 insert into tablename values("name_of_v

在MySQL 中 插入数据时, 字符串型值要用双引号或单引号引起来,数值型不用引号(加引号就会报错)

在插入日期date 时  正确的格式是 '0000-00-00'

例如 name (varchar20), age (int 11) , birth(date)

 

那么插入格式是

 insert into tablename values("name_of_value",20,'2010-12-12');

注意了  这个 age 是 int 数据型 所以20 可以不用引起来 也可以加上 而 birth是 date型 需要按0000-00-00 格式用单引号引起来

Statement:
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