Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify and delete data records in mysql

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Mysql how to modify and delete data records, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

How to modify and delete data records by mysql

Modify the record with update

Columns to be changed by UPDATEtbl_nameSET

Records to be updated by WHERE

The WHERE clause here is optional, so if not specified, each record in the table is updated.

How to modify and delete data records by mysql

For example, in the pet table, we find that the gender of the pet Whistler is not specified, so we can modify the record like this:

Mysql > updatepetsetsex='f'wherename= "Whistler"

Delete a record with delete

The DELETE statement has the following format:

Records to be deleted by DELETEFROMtbl_nameWHERE

The WHERE clause specifies which records should be deleted. It is optional, but if not, all records will be deleted. This means that the simplest DELETE statements are also the most dangerous.

This query will clear all the contents of the table. Be careful!

To delete a specific record, use the WHERE clause to select the record you want to delete. This is similar to the WHERE clause in the SELECT statement.

Mysql > deletefrompetwherename= "Whistler"

You can empty the entire table with the following statement:

Mysql > deletefrompet

After reading the above, have you mastered the method of how to modify and delete data records in mysql? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report