Xavizo Xavizo - 5 months ago 5x
Java Question

Insert data to existing record

how can i insert and replace data in table to existing row from java, depends on ID?
I want to give statement like that

insert into rooms(status) values('occupied')
where id_room = 5;


You need to use update statement instead of insert.

Like that:

Update rooms set status = 'accupied' where Id = 5

So now the table will update the data with the new values.