MySQL update and delete, MySQL update and delete
The SQL statement for updating and deleting operations is relatively simple. However, when using UPDATE, pay attention to the limitations of the WEHER condition. The following statement only updates the email address with id 10005, if the WHERE statement restriction is not added, update all emails in the table to the elmer@fudd.com:
Delete the value of a column and set it to NULL.
Use DELETE to DELETE the SQL statement of a row. When using DELETE, add WHERE to DELETE the row you want to DELETE. If this parameter is not specified, all rows in the table will be deleted.
Delete from MERs
WHERE cust_id = 10005;
Now we can see that the importance of the primary key of a table. In addition, before UPDATE and DELETE, you can use the SELECT statement to test whether the conditions specified by the WHERE statement are correct.
Mysql deletes a specified string from a field.
Update table set field = ''where field = 'xxxxx'
A question about MySQL deletion (update)
In the employee table, each employee should correspond to a department number. Just write it as follows:
Delete from employee table where Department number = id of the deleted department;