Sorry for the title, I couldnt explain what I meant in the title. I have 2 tables, one is patient table and other one is used medicine table. Patients primary key is foreign