-- MySQL dump 10.13  Distrib 8.0.20, for Win64 (x86_64)
--
-- Host: localhost    Database: assignment1
-- ------------------------------------------------------
-- Server version	8.0.20

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `address`
--

DROP TABLE IF EXISTS `address`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `address` (
  `Address_ID` int NOT NULL AUTO_INCREMENT,
  `Address_Recipient_Name` varchar(50) NOT NULL,
  `Address_Line_1` varchar(200) NOT NULL,
  `Address_Line_2` varchar(200) DEFAULT NULL,
  `Postal_Code` char(6) NOT NULL,
  `City` varchar(15) NOT NULL,
  `Province` char(2) NOT NULL,
  `IsPOBox` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`Address_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `address`
--

LOCK TABLES `address` WRITE;
/*!40000 ALTER TABLE `address` DISABLE KEYS */;
INSERT INTO `address` VALUES (1,'First Customer','123 Address Lane',NULL,'A0A0A0','Citytown','ON',1),(2,'My Own Business','234 ECommerce Street',NULL,'C3C3C3','Businessville','NS',0),(3,'First Customer','900 Fakey Drive','Unit #F','Z9Z9Z9','Fakerton','FK',0),(4,'Second Customer','222 Secunda Private',NULL,'B2B2B2','Townsville','AB',0),(5,'Acme Supplies Company','555 Sourcing Avenue',NULL,'S5S5S5','Megatown','BC',1),(6,'Shipsters Express','777 Going Place','Second Floor, Unit 277','L7L7L7','Gonerton','MB',0);
/*!40000 ALTER TABLE `address` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `customer`
--

DROP TABLE IF EXISTS `customer`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `customer` (
  `Customer_ID` int NOT NULL AUTO_INCREMENT,
  `Cust_First_Name` varchar(20) DEFAULT NULL,
  `Cust_Last_Name` varchar(30) NOT NULL,
  `Cust_Email` varchar(50) DEFAULT NULL,
  `Cust_Phone_No` char(12) NOT NULL,
  PRIMARY KEY (`Customer_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `customer`
--

LOCK TABLES `customer` WRITE;
/*!40000 ALTER TABLE `customer` DISABLE KEYS */;
INSERT INTO `customer` VALUES (1,'First','Customer','firstyfakey@netstuff.com','111-111-1111'),(2,'Second','Customer','SecundusII@myemail.com','222-222-2222');
/*!40000 ALTER TABLE `customer` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `inboundshipping`
--

DROP TABLE IF EXISTS `inboundshipping`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `inboundshipping` (
  `Inbound_Shipping_ID` int NOT NULL AUTO_INCREMENT,
  `In_Ship_Co` int NOT NULL,
  `In_Ship_Address` int NOT NULL,
  `In_Ship_Cost` decimal(6,2) DEFAULT '0.00',
  PRIMARY KEY (`Inbound_Shipping_ID`),
  KEY `In_Ship_Co` (`In_Ship_Co`),
  KEY `In_Ship_Address` (`In_Ship_Address`),
  CONSTRAINT `inboundshipping_ibfk_1` FOREIGN KEY (`In_Ship_Co`) REFERENCES `shippingcompany` (`Shipping_Company_ID`),
  CONSTRAINT `inboundshipping_ibfk_2` FOREIGN KEY (`In_Ship_Address`) REFERENCES `address` (`Address_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `inboundshipping`
--

LOCK TABLES `inboundshipping` WRITE;
/*!40000 ALTER TABLE `inboundshipping` DISABLE KEYS */;
INSERT INTO `inboundshipping` VALUES (1,1,6,130.24),(2,1,6,224.24),(3,1,6,35.04);
/*!40000 ALTER TABLE `inboundshipping` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `invoicedetails`
--

DROP TABLE IF EXISTS `invoicedetails`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `invoicedetails` (
  `Invoice_No` int NOT NULL AUTO_INCREMENT,
  `Inv_Pay_ID` int NOT NULL,
  `Inv_Cust_ID` int NOT NULL,
  `Subtotal_Prods` decimal(7,2) DEFAULT '0.00',
  `Inv_Total` decimal(7,2) DEFAULT '0.00',
  `Inv_Ship_Details` int NOT NULL,
  `Order_Status` varchar(20) DEFAULT 'Pending',
  PRIMARY KEY (`Invoice_No`),
  KEY `Inv_Pay_ID` (`Inv_Pay_ID`),
  KEY `Inv_Cust_ID` (`Inv_Cust_ID`),
  KEY `Inv_Ship_Details` (`Inv_Ship_Details`),
  CONSTRAINT `invoicedetails_ibfk_1` FOREIGN KEY (`Inv_Pay_ID`) REFERENCES `paymenttype` (`Payment_ID`),
  CONSTRAINT `invoicedetails_ibfk_2` FOREIGN KEY (`Inv_Cust_ID`) REFERENCES `customer` (`Customer_ID`),
  CONSTRAINT `invoicedetails_ibfk_3` FOREIGN KEY (`Inv_Ship_Details`) REFERENCES `outboundshipping` (`Outbound_Shipping_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `invoicedetails`
--

LOCK TABLES `invoicedetails` WRITE;
/*!40000 ALTER TABLE `invoicedetails` DISABLE KEYS */;
INSERT INTO `invoicedetails` VALUES (1,1,1,99.99,109.00,1,'Complete'),(2,2,2,94.98,104.98,3,'In Transit'),(3,1,1,724.90,761.43,2,'Pending');
/*!40000 ALTER TABLE `invoicedetails` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `invoiceitems`
--

DROP TABLE IF EXISTS `invoiceitems`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `invoiceitems` (
  `Inv_No` int NOT NULL,
  `Prod_ID` int NOT NULL,
  `Prod_Quant` int unsigned DEFAULT '1',
  PRIMARY KEY (`Inv_No`,`Prod_ID`),
  KEY `Prod_ID` (`Prod_ID`),
  CONSTRAINT `invoiceitems_ibfk_1` FOREIGN KEY (`Inv_No`) REFERENCES `invoicedetails` (`Invoice_No`),
  CONSTRAINT `invoiceitems_ibfk_2` FOREIGN KEY (`Prod_ID`) REFERENCES `product` (`Product_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `invoiceitems`
--

LOCK TABLES `invoiceitems` WRITE;
/*!40000 ALTER TABLE `invoiceitems` DISABLE KEYS */;
INSERT INTO `invoiceitems` VALUES (1,2,1),(2,3,1),(2,4,1),(3,1,3),(3,2,2),(3,3,5);
/*!40000 ALTER TABLE `invoiceitems` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `outboundshipping`
--

DROP TABLE IF EXISTS `outboundshipping`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `outboundshipping` (
  `Outbound_Shipping_ID` int NOT NULL AUTO_INCREMENT,
  `Out_Ship_Co` int NOT NULL,
  `Out_Ship_Address` int NOT NULL,
  `Out_Ship_Cost` decimal(6,2) DEFAULT '0.00',
  PRIMARY KEY (`Outbound_Shipping_ID`),
  KEY `Out_Ship_Co` (`Out_Ship_Co`),
  KEY `Out_Ship_Address` (`Out_Ship_Address`),
  CONSTRAINT `outboundshipping_ibfk_1` FOREIGN KEY (`Out_Ship_Co`) REFERENCES `shippingcompany` (`Shipping_Company_ID`),
  CONSTRAINT `outboundshipping_ibfk_2` FOREIGN KEY (`Out_Ship_Address`) REFERENCES `address` (`Address_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `outboundshipping`
--

LOCK TABLES `outboundshipping` WRITE;
/*!40000 ALTER TABLE `outboundshipping` DISABLE KEYS */;
INSERT INTO `outboundshipping` VALUES (1,1,1,10.00),(2,1,3,36.53),(3,1,4,10.00);
/*!40000 ALTER TABLE `outboundshipping` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `paymenttype`
--

DROP TABLE IF EXISTS `paymenttype`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `paymenttype` (
  `Payment_ID` int NOT NULL AUTO_INCREMENT,
  `Card_Type` varchar(20) DEFAULT NULL,
  `Cardholder_Name` varchar(50) NOT NULL,
  `Card_No` varchar(20) NOT NULL,
  `Card_Exp_Date` varchar(4) NOT NULL,
  `Card_Security` varchar(4) NOT NULL,
  `Billing_Address_ID` int NOT NULL,
  PRIMARY KEY (`Payment_ID`),
  KEY `Billing_Address_ID` (`Billing_Address_ID`),
  CONSTRAINT `paymenttype_ibfk_1` FOREIGN KEY (`Billing_Address_ID`) REFERENCES `address` (`Address_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `paymenttype`
--

LOCK TABLES `paymenttype` WRITE;
/*!40000 ALTER TABLE `paymenttype` DISABLE KEYS */;
INSERT INTO `paymenttype` VALUES (1,'Visa','First Customer','xxxxxxxxxxxx','1121','111',1),(2,'Amex','Second Secundus','123123123123','1222','222',4),(3,'Mastercard','Business Owner','9876543210','0125','000',2);
/*!40000 ALTER TABLE `paymenttype` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `product`
--

DROP TABLE IF EXISTS `product`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `product` (
  `Product_ID` int NOT NULL AUTO_INCREMENT,
  `Prod_Name` varchar(50) NOT NULL DEFAULT 'Test',
  `Prod_Desc` varchar(500) DEFAULT NULL,
  `Prod_Price` decimal(6,2) DEFAULT '0.00',
  `Prod_Quant` int unsigned DEFAULT '0',
  PRIMARY KEY (`Product_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `product`
--

LOCK TABLES `product` WRITE;
/*!40000 ALTER TABLE `product` DISABLE KEYS */;
INSERT INTO `product` VALUES (1,'Superior Thingy','Its better than everyone elses',49.99,45),(2,'Best Whatsit','So much better than the other ones',99.99,32),(3,'Highest Ranked Stuff','Performs better than the leading version',74.99,17),(4,'Premium Doodad','Luxury at its finest',19.99,61),(5,'Test Item',NULL,99.99,0),(6,'Newfangled Whizbang','Newest and whizziest',34.99,0);
/*!40000 ALTER TABLE `product` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `purchaseorderdetails`
--

DROP TABLE IF EXISTS `purchaseorderdetails`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `purchaseorderdetails` (
  `Purchase_Order_No` int NOT NULL AUTO_INCREMENT,
  `PO_Pay_ID` int NOT NULL,
  `PO_Supplier_ID` int NOT NULL,
  `Subtotal_Prods` decimal(9,2) DEFAULT '0.00',
  `PO_Total` decimal(9,2) DEFAULT '0.00',
  `PO_Ship_Details` int NOT NULL,
  `Order_Received` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`Purchase_Order_No`),
  KEY `PO_Pay_ID` (`PO_Pay_ID`),
  KEY `PO_Supplier_ID` (`PO_Supplier_ID`),
  KEY `PO_Ship_Details` (`PO_Ship_Details`),
  CONSTRAINT `purchaseorderdetails_ibfk_1` FOREIGN KEY (`PO_Pay_ID`) REFERENCES `paymenttype` (`Payment_ID`),
  CONSTRAINT `purchaseorderdetails_ibfk_2` FOREIGN KEY (`PO_Supplier_ID`) REFERENCES `supplier` (`Supplier_ID`),
  CONSTRAINT `purchaseorderdetails_ibfk_3` FOREIGN KEY (`PO_Ship_Details`) REFERENCES `inboundshipping` (`Inbound_Shipping_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `purchaseorderdetails`
--

LOCK TABLES `purchaseorderdetails` WRITE;
/*!40000 ALTER TABLE `purchaseorderdetails` DISABLE KEYS */;
INSERT INTO `purchaseorderdetails` VALUES (1,3,1,1225.00,1355.24,1,1),(2,3,1,2882.00,3106.24,2,1),(3,3,1,120.00,155.04,3,0);
/*!40000 ALTER TABLE `purchaseorderdetails` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `purchaseorderitems`
--

DROP TABLE IF EXISTS `purchaseorderitems`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `purchaseorderitems` (
  `PO_No` int NOT NULL,
  `Prod_ID` int NOT NULL,
  `Prod_Quant` int unsigned DEFAULT '1',
  PRIMARY KEY (`PO_No`,`Prod_ID`),
  KEY `Prod_ID` (`Prod_ID`),
  CONSTRAINT `purchaseorderitems_ibfk_1` FOREIGN KEY (`PO_No`) REFERENCES `purchaseorderdetails` (`Purchase_Order_No`),
  CONSTRAINT `purchaseorderitems_ibfk_2` FOREIGN KEY (`Prod_ID`) REFERENCES `product` (`Product_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `purchaseorderitems`
--

LOCK TABLES `purchaseorderitems` WRITE;
/*!40000 ALTER TABLE `purchaseorderitems` DISABLE KEYS */;
INSERT INTO `purchaseorderitems` VALUES (1,1,5),(1,2,9),(1,3,17),(2,1,40),(2,2,23),(2,4,61),(3,6,6);
/*!40000 ALTER TABLE `purchaseorderitems` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `shippingcompany`
--

DROP TABLE IF EXISTS `shippingcompany`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `shippingcompany` (
  `Shipping_Company_ID` int NOT NULL AUTO_INCREMENT,
  `Ship_Co_Name` varchar(50) NOT NULL,
  `Ship_Co_Email` varchar(50) DEFAULT NULL,
  `Ship_Co_Phone_No` char(12) DEFAULT NULL,
  `Ship_Co_Address_ID` int NOT NULL,
  PRIMARY KEY (`Shipping_Company_ID`),
  KEY `Ship_Co_Address_ID` (`Ship_Co_Address_ID`),
  CONSTRAINT `shippingcompany_ibfk_1` FOREIGN KEY (`Ship_Co_Address_ID`) REFERENCES `address` (`Address_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `shippingcompany`
--

LOCK TABLES `shippingcompany` WRITE;
/*!40000 ALTER TABLE `shippingcompany` DISABLE KEYS */;
INSERT INTO `shippingcompany` VALUES (1,'Shipsters Express','info@shipsters.ca','777-777-7777',6);
/*!40000 ALTER TABLE `shippingcompany` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `supplier`
--

DROP TABLE IF EXISTS `supplier`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `supplier` (
  `Supplier_ID` int NOT NULL AUTO_INCREMENT,
  `Supplier_Co_Name` varchar(40) NOT NULL,
  `Contact_Name` varchar(50) DEFAULT NULL,
  `Supplier_Email` varchar(50) DEFAULT NULL,
  `Supplier_Phone_No` char(12) NOT NULL,
  `Supplier_Address_ID` int NOT NULL,
  PRIMARY KEY (`Supplier_ID`),
  KEY `Supplier_Address_ID` (`Supplier_Address_ID`),
  CONSTRAINT `supplier_ibfk_1` FOREIGN KEY (`Supplier_Address_ID`) REFERENCES `address` (`Address_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `supplier`
--

LOCK TABLES `supplier` WRITE;
/*!40000 ALTER TABLE `supplier` DISABLE KEYS */;
INSERT INTO `supplier` VALUES (1,'Acme Supplies Company','Betsy McAcmeson','betsy@acmesupplies.com','555-555-5555',5);
/*!40000 ALTER TABLE `supplier` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2020-06-23 17:02:51
