Xavizo Xavizo - 1 year ago 71
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;

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download