Skip to content

Instantly share code, notes, and snippets.

@cluelesscoder
Created May 16, 2012 01:27
Show Gist options
  • Save cluelesscoder/2706565 to your computer and use it in GitHub Desktop.
Save cluelesscoder/2706565 to your computer and use it in GitHub Desktop.
SHOW CREATE
mysql> show tables;
+---------------------+
| Tables_in_impindata |
+---------------------+
| countries |
| prioritycodes |
| sectors |
| stocks |
+---------------------+
4 rows in set (0.00 sec)
mysql> show create table sectors;
+---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| sectors | CREATE TABLE `sectors` (
`sector_id` int(11) NOT NULL auto_increment,
`sector_name` varchar(255) default NULL,
`sector_desc` text,
`sector_lastupdated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`sector_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 |
+---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show create table stocks;
+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| stocks | CREATE TABLE `stocks` (
`stock_id` int(11) NOT NULL auto_increment,
`stock_name` varchar(255) default NULL,
`stock_ticker` varchar(255) default NULL,
`stock_desc` text,
`stock_lastupdated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`sector_id` int(11) NOT NULL,
`country_id` int(11) NOT NULL,
`prioritycode_id` int(11) NOT NULL,
PRIMARY KEY (`stock_id`),
KEY `sector_id` (`sector_id`),
KEY `country_id` (`country_id`),
KEY `prioritycode_id` (`prioritycode_id`),
CONSTRAINT `stocks_ibfk_1` FOREIGN KEY (`sector_id`) REFERENCES `sectors` (`sector_id`) ON UPDATE CASCADE,
CONSTRAINT `stocks_ibfk_2` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) ON UPDATE CASCADE,
CONSTRAINT `stocks_ibfk_3` FOREIGN KEY (`prioritycode_id`) REFERENCES `prioritycodes` (`prioritycode_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 |
+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment