MySQL update and delete, MySQL update and delete

Source: Internet
Author: User
Tags mysql update

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;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.