tags:

views:

25

answers:

3

Hi, I have a small problem.

I am creating an appointment table where in the foreign key is patient id which is referenced from patient table.This table is for all registered patients.

there will be unregistered patients also, who will be seeking appointments.SO i just need to store the name,phone and few details.

I don't want to make these 2 as different tables.

So is there a way to skip the integrity check of foreign key when i ma inserting unregistered patient data

+2  A: 

Create a new patient id for unregistered patients. Use a column to mark whether a patient is unregistered: patient_registered ENUM( 'yes', 'no' )

Alternatively, allow for NULL values in your patient_id column, and use NULL as the value for each patient row that refers to an unregistered patient.

dionyziz
since the patient_id in parent table is not nullable ...so here it cant be nullable. so to make it nullable i need to remove the foreign key relation ship with parent table.
pradeep
A: 

Make the patient_id column nullable in the appointment table.

Ike Walker
A: 

You could also have an "unregistered patient" record in the patients table and use that every time you need to add an unregistered patient if you wish to avoid NULLs.

t0ne