var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Getting a parent key error
i get a error message like this: Table RENTAL_ITEM in RENTALB23 does not have a matching parent key.
this is the sql:
CREATE TABLE RENTALB23/RENTAL_ITEM (RENTALITEM# INT PRIMARY KEY,
RENTALTYPE CHAR(3), TITLE CHAR(30), CATEGORY CHAR(15), DUEDATE DATE,
FOREIGN KEY(RENTALTYPE) REFERENCES
RENTALB23/RENTAL_CHARGE(RENTALTYPE), FOREIGN KEY(CATEGORY)
this is the sql for the rental_charge table:
CREATE TABLE RENTALB23/RENTAL_CHARGE (RENTALTYPE CHAR(3),
CATEGORY CHAR(15), CHARGE DECIMAL(5,2), PRIMARY KEY(RENTALTYPE,
any ideas what can cause this?
are you sure you are using MySQL?
if this is throwing you for a loop, then you need to investigate learning opportunities in your area. The issue is that the value you are trying to insert for either RENTALTYPE or CATEGORY in the table RENTAL_ITEM does not exist in the table RENTAL_CHARGE. If you look at your DDL there is a foreign key defined on those 2 columns, which means you have to have those items in the parent table before you can put them in the child table.
well the parent table is: rental_charge
i made that first and then made the RENTAL_ITEM table that has the foreign keys but the error is the same
What is the primary key on rental_charge?
What is the foreign key on rental_item?
Look at the error message.
Do the primary key and foreign key match?
Why do you think you get the error?
If you think about it and answer these questions, you will have gotten your answer and learned something.
ye i fixed it i concatenated the foreign key
Last edited by matthew15; 06-21-08 at