---
title: "mysql text, timestamp datatype 相关笔记"
author: "luolonghao"
date: "2009-02-03T19:11:27Z"
tags: []
slug: "mysql-text-timestamp-datatype"
draft: false
lastmod: "2009-02-03T19:11:27Z"
id: 322606
url: "https://luolonghao.iteye.com/blog/322606"
---

1. create table时，blob, text类型不能有default value。
以下SQL会报警告。

```java
create table ( a text not null default '');
```


2. 第一个字段为timestamp not null时，default值为current_timestamp。第二个字段开始 default为0。

3. 一个表里只能用一个default current_timestamp, on update current_timestamp。
以下SQL会报错。

```java
create table ( a timestamp not null, b timestamp not null default current_timestamp);
```