I am trying to add data into a column called address for a certain user. This is the code I am using;
Insert into register(address) values("Cork") where userId=1;
Try this:
Update register set address='Cork' where userId=1
If something already exists, we use Update.
I suspect you need update
statement rather than insert
:
update register
set address = 'Cork'
where userId = 1;
If you want to append a value, use the CONCAT()
function, as in:
update register set address = concat(address, 'Cork') where userId = 1;
If you want to set the value, then a simple UPDATE
will do, as in:
update register set address = 'Cork' where userId = 1;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.