sql - MySQL Insert Where query -


What is wrong with this query:

  Enter user (weight, desired) values 160, 145) where id = 1;  

This works without the WHERE section. I forgot my SQL.

Where MySQL does not support the block so your query will fail because it will stand.

If you are trying to insert a new row with ID 1, consider your ID column as unique or primary:

 < Code> Log in user (id, weight, desired) value (1, 160, 145);  

If you are trying to change the weight / desired, then the value of the current with the id 1 should be the white value:

  Update SET weight = 160, desired desired = 145 WHERE id = 1;  

You can also use INSERT if you want. But on the duplicate syntax:

  User (ID, weight, Enter the desired values ​​1, 160, 145) Duplicate key update weight = 160, desired desired = 145  

or the like:

  In the INSERT user, it is important to note that SET id = 1, weight = 160, desired weight = duplicate key update weight = 160, desired desired = 145  

If your < Code> Id column is an autointerment after the column you can leave it from your INSERT simultaneously and mysql can increase it normally.


Comments