Let me apologize if tags are wrong, I tried reading the requirements and barely understand as I have zero background in this field but tried my best to select proper tags. Basically, I am new to SQL language, I have tried at least 5 hours solving all of my errors from oracle apex, but one problem was really unsolvable, I do not understand the error code. Looks like a simple error that more mature programmers would quickly identify, therefore here is the code.
Intro: this is a data model on my country's contact tracing system, it is not much as this is my 1st subject related to any programming. Code below is a complete file with 12 tables, just need to know what is the error that cause it unable to run. picture1 feedback after run(line 1-15) picture2 feedback after run (line 16-24)
DROP TABLE INDIVIDUAL;
DROP TABLE DAILYMONITORING;
DROP TABLE CATEGORY;
DROP TABLE DEPENDANT;
DROP TABLE VISITRECORD;
DROP TABLE LOCATION;
DROP TABLE TRAVELRECORD;
DROP TABLE COUNTRY;
DROP TABLE FAMILYMEMBER;
DROP TABLE FAMILYRECORD;
DROP TABLE OFFICER;
DROP TABLE HEALTHOFFICE;
--Student A--
CREATE TABLE FAMILYMEMBER (
famMobileNo CHAR(12) PRIMARY KEY,
familyName CHAR(100) NOT NULL
);
--Student A (Intersection Entity)--
CREATE TABLE FAMILYRECORD (
famMobileNo CHAR(12),
mysjID CHAR(20),
constraint familyrecord_PK PRIMARY KEY (famMobileNo, mysjID),
constraint familyrecord_familymember_FK FOREIGN KEY (famMobileNo) REFERENCES Familymember (famMobileNo),
constraint familyrecord_familymember_FK FOREIGN KEY (mysjID) REFERENCES Individual(mysjID)
);
--Student A--
CREATE TABLE OFFICER (
officerID CHAR(7) PRIMARY KEY,
officerName CHAR(100) NOT NULL,
healthOfficeID CHAR(7) NOT NULL,
constraint officer_healthoffice_FK FOREIGN KEY (healthOfficeID) REFERENCES Healthoffice (healthOfficeID)
);
--Student A--
CREATE TABLE HEALTHOFFICE (
healthOfficeID CHAR(7) PRIMARY KEY,
healthOfficeAddress CHAR(100) NOT NULL,
telephoneNo CHAR(12) NOT NULL
);
--Student A (Intersection Entity)--
CREATE TABLE TRAVELRECORD(
countryID CHAR(6),
mysjID CHAR(20),
duration INTEGER CHECK(duration>0),
constraint travelrecord_PK PRIMARY KEY (countryID,mysjID),
constraint travelrecord_country_FK FOREIGN KEY(countryID) REFERENCES Country(countryID),
constraint travelrecord_individual_FK FOREIGN KEY(mysjID) REFERENCES Individual(mysjID)
);
--Student A--
CREATE TABLE COUNTRY(
countryID CHAR(6) PRIMARY KEY,
countryName CHAR(50) NOT NULL
);
--Student B--
CREATE TABLE INDIVIDUAL(
mysjID CHAR(20) PRIMARY KEY,
passportIC CHAR(20) NOT NULL,
name VARCHAR(35) NOT NULL,
ethnicity VARCHAR(20),
birthDate Date NOT NULL,
mobileNo CHAR(12),
housingAddress CHAR(100),
dateTimeArrival Date,
wristbandID CHAR(7),
yearsOfLiving INTEGER,
IDV_type CHAR(20) NOT NULL CHECK(IDV_type IN ('TRAVELLER','NONTRAVELLER')),
officerID CHAR(7),
categoryNo INTEGER NOT NULL,
constraint individual_officer_FK FOREIGN KEY(officerID) REFERENCES Officer(officerID),
constraint individual_category_FK FOREIGN KEY(categoryNo) REFERENCES Category(categoryNo)
);
--Student B--
CREATE TABLE DAILYMONITORING(
dailyMonitoringID CHAR(5) PRIMARY KEY,
dateOfMonitoring Date NOT NULL,
patientSymptoms VARCHAR(25) NOT NULL,
dayOfMonitoring INTEGER NOT NULL,
mysjID CHAR(20) NOT NULL,
constraint dailymonitoring_individual_FK FOREIGN KEY(mysjID) REFERENCES Individual(mysjID)
);
--Student B--
CREATE TABLE CATEGORY(
categoryNo INTEGER PRIMARY KEY,
dateOfArrivalInMalaysia Date,
FlightNoOrPublicTransportNo CHAR(8),
dateOfSymptomsOnset Date,
relationshipWithCase VARCHAR(20),
dateOfExposure Date,
CTY_type CHAR(3) NOT NULL CHECK(CTY_type IN ('PUI','CCI'))
);
--Student B--
CREATE TABLE VISITRECORD(
QRcode CHAR(20),
mysjID CHAR(20),
dateTimeScanQR Date NOT NULL,
constraint visitrecord_PK PRIMARY KEY(QRcode,mysjID),
constraint visitrecord_location_FK FOREIGN KEY(QRcode) REFERENCES Location(QRcode),
constraint visitrecord_individual_FK FOREIGN KEY(mysjID) REFERENCES Individual(mysjID)
);
--Student B--
CREATE TABLE LOCATION(
QRcode CHAR(20) PRIMARY KEY,
locationAddress VARCHAR(100) NOT NULL,
description VARCHAR(30)
);
--Student B--
CREATE TABLE DEPENDANT(
passportICdependant CHAR(20) PRIMARY KEY,
dependantName CHAR(100) NOT NULL,
dependantType CHAR(10) NOT NULL CHECK (dependantType IN ('Child','OKU')),
mysjID CHAR(20),
constraint dependant_individual_FK FOREIGN KEY(mysjID) REFERENCES Individual(mysjID)
);