Trying to do a simple insert into statement but getting an foreign key relationship error.
insert into orders (userId, orderDate, shippingDate)
values('xyz123', now(), now());
The error I am getting is
"Cannot add or update a child row:a foreign key constraint fails ('example_1010.
orders,CONSTRAINT
orders_ibfk1FOREIGN KEY (
userId) REFERENCES
users(
userid`))"
I think I need to use an "in clause" to bypass the constraint but I don't think I am using it correctly.
insert into orders (userId, orderDate, shippingDate)
values('xyz123', now(), now())
in (select userId from users);