How to add a where clause in a MySQL Insert statement?

前端 未结 8 995
刺人心
刺人心 2020-11-30 12:56

This doesn\'t work:

INSERT INTO users (username, password) VALUES (\"Jack\",\"123\") WHERE id=\'1\';

Any ideas how to narrow insertion to a

8条回答
  •  误落风尘
    2020-11-30 13:21

    Try this:

    Update users
    Set username = 'Jack', password='123'
    Where ID = '1'
    

    Or if you're actually trying to insert:

    Insert Into users (id, username, password) VALUES ('1', 'Jack','123');
    

提交回复
热议问题