If you want to see the schema information of your table, you can use one of the following:
SHOW CREATE TABLE child; -- Option 1
CREATE TABLE `child` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fullName` varchar(100) NOT NULL,
`myParent` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `mommy_daddy` (`myParent`),
CONSTRAINT `mommy_daddy` FOREIGN KEY (`myParent`) REFERENCES `parent` (`id`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
If used from the mysql commandline tool, this is less verbose:
SHOW CREATE TABLE child \G
A less descriptive way of showing the table structure:
mysql> CREATE TABLE Tab1(id int, name varchar(30));
Query OK, 0 rows affected (0.03 sec)
mysql> DESCRIBE Tab1; -- Option 2
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(30) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
Both DESCRIBE and DESC gives the same result.
To see DESCRIBE
performed on all tables in a database at once, see this Example.