---
title: "MySQL SQL Create demo"
author: "fairy_xzc"
date: "2018-10-22T15:10:18Z"
tags: []
categories: ["数据库"]
slug: "mysql-sql-create-demo"
draft: false
lastmod: "2018-10-22T15:10:18Z"
id: 2432552
url: "https://agilestyle.iteye.com/blog/2432552"
---

ddl demo

```
CREATE TABLE IF NOT EXISTS user (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `username` varchar(32) NOT NULL,
    `password` varchar(32) NOT NULL,
    `status` tinyint(4) unsigned NOT NULL DEFAULT '1',
    `is_deleted` tinyint(1) unsigned NOT NULL DEFAULT '0',
    `create_time` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `update_time` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
    PRIMARY KEY (`id`),
    UNIQUE KEY `unique_username` (`username_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```