I removed the foreign key constraints to add data in, then I later altered the tables to add the foreign keys back in. However, with one particular table thats being altered, I keep getting an 1452 error code back.
Data
INSERT INTO Invoice
values
(323, 'Head Injury Patient', 'Surgery and Bed Stay', 150.00, 918),
(543, 'Eye Injury Patient', 'Medicine and hourly eye drops', 50.00, 910),
(859, 'Leg Injury Patient', 'Surgery and Bed Stay', 100.00, 915);
Adding Foreign Key
Alter table Invoice
Add Foreign Key(Medicine_ID) References Medicine(Medicine_ID);
Construction of Invoice
Create table Invoice (
Invoice_ID INT,
Invoice_description varchar(150),
Treatment varchar (150) NOT NULL,
Hospital_Cost INT NOT NULL,
Medicine_ID INT,
Primary Key(Invoice_ID)
);
Construction of Medicine
Create table Medicine (
Medicine_ID INT,
Medicine_name varchar(150),
Medicine_cost INT NOT NULL,
Medicine_description Varchar (150),
Brand_name varchar(150),
Manufacturer varchar(150),
Generic_name varchar(150),
price_per_unit INT,
Quantity_in_stock INT,
Primary Key(Medicine_ID)
);