Answers for "how to make a column a foreign key in phpmyadmin xampp"

PHP
1

how to make a column a foreign key in phpmyadmin xampp

DROP TABLE IF EXISTS `Customer`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Customer` (
  `CustomerID` varchar(45) NOT NULL,
  `Username` varchar(45) NOT NULL,
  `Password` varchar(45) NOT NULL,
  `Gender` varchar(45) NOT NULL,
  `DoB` date NOT NULL,
  `AddressID` varchar(45) NOT NULL,
  `ContactID` varchar(45) NOT NULL,
  `Picture` blob NOT NULL,
  PRIMARY KEY (`CustomerID`),
  KEY `AddressID` (`AddressID`),
  KEY `ContactID` (`ContactID`),
  CONSTRAINT `AddressID` FOREIGN KEY (`AddressID`) REFERENCES `Addresses` (`AddressID`) ON DELETE CASCADE ON UPDATE CASCADE,
  // There Must be a Table Called Addresses which holds a Column AddressID as PRIMARY KEY
  CONSTRAINT `ContactID` FOREIGN KEY (`ContactID`) REFERENCES `Contacts` (`ContactID`) ON DELETE CASCADE ON UPDATE CASCADE
    // There Must be a Table Called Contacts which holds a Column ContactID as PRIMARY KEY
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

@Zenonymous
Posted by: Guest on August-22-2021

Code answers related to "how to make a column a foreign key in phpmyadmin xampp"

Browse Popular Code Answers by Language