- Hands-On GUI Programming with C++ and Qt5
- Lee Zhi Eng
- 202字
- 2021-08-27 19:00:19
DELETE
The DELETE statement deletes data from a specific table of a database. For example, the following command deletes a data from the user table that carries the ID 1:
DELETE FROM user WHERE id = 1;
Even though you can use this statement to delete unwanted data, it is not recommended to delete any data from your database because the action cannot be undone. It is better to add another column to your table called status and use that to indicate whether data should be shown or not. For example, if your user deletes data on the front end application, set the status of that data to (let's say) 1 instead of 0. Then, when you want to display data on the front end, display only the data that carries a status of 0:

This way, any data that has been accidentally deleted can be recovered with ease. You can also use a BOOLEAN type for this if you only plan to use true or false. I usually use TINYINT just in case I need a third or fourth status in the future. For more information regarding the DELETE statement, you can refer to the following link:
- 軟件安全技術
- DBA攻堅指南:左手Oracle,右手MySQL
- 國際大學生程序設計競賽中山大學內部選拔真題解(二)
- ASP.NET MVC4框架揭秘
- SOA實踐
- Learning PostgreSQL
- MySQL 8從入門到精通(視頻教學版)
- Python爬蟲開發:從入門到實戰(微課版)
- HTML5 移動Web開發從入門到精通(微課精編版)
- 精通軟件性能測試與LoadRunner實戰(第2版)
- Python機器學習實戰
- Python數據可視化之Matplotlib與Pyecharts實戰
- jQuery Mobile移動應用開發實戰(第3版)
- 執劍而舞:用代碼創作藝術
- Natural Language Processing with Java and LingPipe Cookbook