CREATE TABLE `User` ( `IC` varchar(50), `Name` varchar(50), `PhNo` int(12), `Email` varchar(50), `UserType` varchar(50), CONSTRAINT UNIQUE (IC,UserType), PRIMARY KEY (`IC`) ); CREATE TABLE `Patient` ( `IC` varchar(50), `Case` varchar(50), `UserType` varchar(50), FOREIGN KEY (IC,UserType) REFERENCES USER (IC,UserType), PRIMARY KEY (`IC`) );
INSERT INTO PATIENT(IC,Case,UserType) VALUES ("123456789101","Non-Urgent","Patient");
USER
FOREIGN KEY (IC,UserType) REFERENCES `USER` (IC,UserType),
MySQL :: MySQL 8.0 Reference Manual :: 9.1.1 String Literals[^]: If the ANSI_QUOTES SQL mode is enabled, string literals can be quoted only within single quotation marks because a string quoted within double quotation marks is interpreted as an identifier.
INSERT INTO PATIENT (IC, Case, UserType) VALUES ('123456789101', 'Non-Urgent', 'Patient');
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)