DROP TABLE IF EXISTS `company`;
CREATE TABLE `company` (
`com_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`city` varchar(255) NOT NULL,
PRIMARY KEY (`com_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `company` VALUES ('1', 'RED', 'Boston');
INSERT INTO `company` VALUES ('2', 'ORANGE', 'New York');
INSERT INTO `company` VALUES ('3', 'YELLOW', 'Boston');
INSERT INTO `company` VALUES ('4', 'GREEN', 'Austin');
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
`order_id` int(11) NOT NULL,
`order_date` date NOT NULL,
`com_id` int(11) NOT NULL,
`sales_id` int(11) NOT NULL,
`amount` int(11) NOT NULL,
PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `orders` VALUES ('1', '2014-01-01', '3', '4', '10000');
INSERT INTO `orders` VALUES ('2', '2014-02-01', '4', '5', '5000');
INSERT INTO `orders` VALUES ('3', '2014-03-01', '1', '1', '50000');
INSERT INTO `orders` VALUES ('4', '2014-04-01', '1', '4', '25000');
DROP TABLE IF EXISTS `sales_person`;
CREATE TABLE `sales_person` (
`sales_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`salary` int(11) NOT NULL,
`commission_rate` int(11) NOT NULL,
`hire_date` date NOT NULL,
PRIMARY KEY (`sales_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `sales_person` VALUES ('1', 'John', '100000', '6', '2006-04-01');
INSERT INTO `sales_person` VALUES ('2', 'Amy', '12000', '5', '2010-05-01');
INSERT INTO `sales_person` VALUES ('3', 'Mark', '65000', '12', '2008-12-25');
INSERT INTO `sales_person` VALUES ('4', 'Pam', '25000', '25', '2005-01-01');
INSERT INTO `sales_person` VALUES ('5', 'Alex', '5000', '10', '2005-02-03');
评论