I'm trying to query the C_CONTENT of a specific patient. When I run the query it appears as blank, even though I have populated the relevant tables
select c.C_ID,
c.C_CONTENT,
c.PP_ID
from COMMENTS c, EXIST_IN ei
where ei.P_ID = :P7_P_ID and ei.PP_ID = c.PP_ID
These are the relevant tables
CREATE TABLE "COMMENTS"
( "C_ID" NUMBER(10,0),
"C_CONTENT" VARCHAR2(1200) NOT NULL ENABLE,
"PP_ID" NUMBER(10,0),
CHECK ( c_id > 0 ) ENABLE,
PRIMARY KEY ("C_ID")
USING INDEX ENABLE
)
/
ALTER TABLE "COMMENTS" ADD FOREIGN KEY ("PP_ID")
REFERENCES "PATIENT_PROFILE" ("PP_ID") ENABLE
/
CREATE TABLE "PATIENT_PROFILE"
( "PP_ID" NUMBER(10,0),
"DIAGRAM1" NUMBER(10,0),
"DIAGRAM2" NUMBER(10,0),
CHECK ( pp_id > 0 ) ENABLE,
PRIMARY KEY ("PP_ID")
USING INDEX ENABLE
)
/
CREATE TABLE "EXIST_IN"
( "P_ID" NUMBER(10,0),
"PP_ID" NUMBER(10,0),
PRIMARY KEY ("P_ID", "PP_ID")
USING INDEX ENABLE
)
/
ALTER TABLE "EXIST_IN" ADD FOREIGN KEY ("P_ID")
REFERENCES "PATIENTS" ("P_ID") ENABLE
/
ALTER TABLE "EXIST_IN" ADD FOREIGN KEY ("PP_ID")
REFERENCES "PATIENT_PROFILE" ("PP_ID") ENABLE
question from:
https://stackoverflow.com/questions/65841793/sql-query-from-different-tables 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…