Question: I have two tables created, when information is submitted, my foreign key is not updating along with the rest of the information and the primary
I have two tables created, when information is submitted, my foreign key is not updating along with the rest of the information and the primary key that it is referencing. Here are my create statements. CREATE TABLE `order_table` ( `order_ID` int NOT NULL AUTO_INCREMENT, `soup_type` varchar(255) DEFAULT NULL, `soup_quantity` int DEFAULT NULL, `delivery` varchar(255) DEFAULT NULL, `customer_ID` int NOT NULL , PRIMARY KEY (`order_ID`), KEY `fk_customer_ID` (`customer_ID`), FOREIGN KEY (customer_ID) REFERENCES customer_table(customer_ID) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; CREATE TABLE `customer_table` ( `customer_ID` int NOT NULL AUTO_INCREMENT, `first_name` varchar(255) DEFAULT NULL, `last_name` varchar(255) DEFAULT NULL, `address` varchar(255) DEFAULT NULL, `city` varchar(255) DEFAULT NULL, `state` varchar(255) DEFAULT NULL, `Zipcode` int DEFAULT NULL, `telephone_number` varchar(13) DEFAULT NULL, PRIMARY KEY (`customer_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
