MySQL DDL Demo

Original please indicate the source: https://www.cnblogs.com/agilestyle/p/11606833.html

 

DDL Demo

. 1  the CREATE  TABLE ` User ` (
 2    `id` BIGINT ( 20 is ) unsigned the NOT  NULL the AUTO_INCREMENT,
 . 3    ` mobile` VARCHAR ( 13 is ) the NOT  NULL the COMMENT ' phone number ' ,
 . 4    `user_alias` VARCHAR ( 13 is ) the NOT  NULL the COMMENT ' user alias ' ,
 . 5    `password` VARCHAR ( 128 ) the NOT  NULLThe COMMENT " user password " ,
 . 6    `user_type` tinyint ( . 4 ) unsigned the DEFAULT  NULL the COMMENT ' User Type, 1: general user; 2: VIP members ' ,
 . 7    ` user_state` tinyint ( . 4 ) unsigned the DEFAULT  NULL the COMMENT " user state " ,
 . 8    `reg_channel` tinyint ( . 4 ) unsigned the DEFAULT  NULL the COMMENT ' registered channels ' ,
 . 9    ` reg_time`BIGINT ( 20 is ) unsigned the NOT  NULL the COMMENT ' registration date ' ,
 10    `last_login_time` timestamp ( . 3 ) NULL  the DEFAULT  NULL the COMMENT ' Last login time ' ,
 . 11    ` last_logout_time` timestamp ( . 3 ) NULL  the DEFAULT  NULL the COMMENT ' last logout time ' ,
 12 is    `create_time` timestamp ( . 3 ) the NOT  NULL  the DEFAULT CURRENT_TIMESTAMP(3),
13   `update_time` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
14   PRIMARY KEY (`id`),
15   UNIQUE KEY `uk_mobile` (`mobile`),
16   KEY `idx_reg_channel` (`reg_channel`)
17 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

 

desc user

 

Guess you like

Origin www.cnblogs.com/agilestyle/p/11606833.html
DDL