Subscribed unsubscribe Subscribe Subscribe

hasen's tech life

Twitter: @hasen

MySQLでテーブルのcreate文を取得する

MySQL

# MySQLでテーブルのcreate文を取得する

> show create table TABLE_NAME\G

> *************************** 1. row ***************************
> Table: TABLE_NAME
> Create Table: CREATE TABLE `TABLE_NAME` (
> `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
> `password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
> `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
> `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
> `deleted_at` timestamp NULL DEFAULT NULL,
> PRIMARY KEY (`user_id`)
> ) ENGINE=InnoDB AUTO_INCREMENT=714 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
> 1 row in set (0.00 sec)

参考: https://dev.mysql.com/doc/refman/5.7/en/show-create-table.html