Menampilkan deskripsi struktur tabel mysql

Untuk menampilkan struktur suatu tabel bisa menggunakan perintah DESC atau DESCRIBE, bentuknya seperti berikut

DESC [nama tabel] atau DESCRIBE [nama tabel]

Misalkan saya ingin menampilkan deskripsi struktur dari tabel mahasiswa maka saya ketikan

mysql> DESC mahasiswa;
+——–+————-+——+—–+———+——-+
| Field  | Type        | Null | Key | Default | Extra |
+——–+————-+——+—–+———+——-+
| nim    | int(2)      | YES  |     | NULL    |       |
| nama   | varchar(20) | YES  |     | NULL    |       |
| alamat | varchar(20) | YES  |     | NULL    |       |
| hobi   | varchar(25) | YES  |     | NULL    |       |
+——–+————-+——+—–+———+——-+
4 rows in set (0.00 sec)

Atau bisa juga dengan :

mysql> DESCRIBE mahasiswa;
+——–+————-+——+—–+———+——-+
| Field  | Type        | Null | Key | Default | Extra |
+——–+————-+——+—–+———+——-+
| nim    | int(2)      | YES  |     | NULL    |       |
| nama   | varchar(20) | YES  |     | NULL    |       |
| alamat | varchar(20) | YES  |     | NULL    |       |
| hobi   | varchar(25) | YES  |     | NULL    |       |
+——–+————-+——+—–+———+——-+
4 rows in set (0.00 sec

This entry was posted in mysql and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

:wink: :-| :-x :twisted: :) 8-O :( :roll: :-P :oops: :-o :mrgreen: :lol: :idea: :-D :evil: :cry: 8) :arrow: :-? :?: :!: