Using the SQL DELETE command
In this recipe, we will use the SQL DELETE
command to delete the data we created in the previous recipes.
While deleting data might at first sight sound trivial, once we get a rather large database design in production, things might not be that easy any more.
Because we have designed our GUI database by relating two tables via a primary to foreign key relation, when we delete certain data we do not end up with orphan records because this database design takes care of cascading deletes.
Getting ready
This recipe uses the MySQL database, tables, as well as the data inserted into those tables from the previous recipes in this chapter. In order to show how to create orphan records, we will have to change the design of one ...
Get Python GUI Programming Cookbook 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.