0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【SQL】DDLを確認するコマンド

Posted at

概要

・既にあるテーブルを作成した際のコマンドを確認したいとき
・DDLの外部キー制約などみたいとき

コマンド

SHOW CREATE TABLE テーブル名;

結果

CREATE TABLE テーブル名 (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  hoge_id int(10) unsigned NOT NULL,
  hoge text,
  created datetime DEFAULT NULL,
  updated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  UNIQUE (hoge_id, hoge)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ここにはコメントが表示されます。';

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?