【mysql】mysql更新多个字段

  • 更新数据库中多个字段时要注意:

    • (要更新的字段)set后的字段用,连接,where条件用and连接。
    UPDATE apply_check SET checked=1,result_tutor_no=20170002 WHERE stu_no=20171530 and tutorNo=20170000
    
  • mysql无法正确识别sql语句,会问题。

    比如我这checked字段设置了不能为空,无法识别set后的更新字段,就报错了。

    【报错】

    com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'checked' cannot be null
    

posted @ 2020-06-22 14:38  musecho  阅读(8108)  评论(0编辑  收藏  举报