How to overwrite Database on MySQL Foreign key
I created a simple 2 tables to experiment foreign keys, but when I input values into the Foreign table it does not overwrite current columns.
create table testing2 (balance bigint, stud int, FOREIGN KEY (stud) REFERENCES testing(stud)); insert into testing2 values ('4000','0','1'); insert into testing2 values ('4000','2000','1');
The result would show all the values inserted, I want to overwrite it on my last insert
To overwrite values just use UPDATE instead of INSERT.
Also, why are you trying to insert 3 values in a table with 2 columns?