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 ...

Get Hands-On GUI Programming with C++ and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.