MySQL Practice
MySQL Practice
MySQL Practice
desc customer;
create table orders(order_id int not null primary key, order_date date,customer_id int, amount float, foreign key(customer_id)
references customer(c_id));
desc orders;
insert into orders values(1005,'2022-09-20',6,3000);
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`sales`.`orders`, CONSTRAINT `orders_ibfk_1`
FOREIGN KEY (`customer_id`) REFERENCES `customer` (`c_id`))