Book Image

Python GUI Programming Cookbook

By : Burkhard Meier
Book Image

Python GUI Programming Cookbook

By: Burkhard Meier

Overview of this book

Table of Contents (18 chapters)
Python GUI Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 of our database tables.

How to do it…

We kept our database design simple by using only two database tables.

While this works when we delete data, there is always a chance of ending up with orphan records. What this means is that we delete data in one table...