Using the SQL INSERT command

This recipe presents the entire Python code that shows you how to create and drop MySQL databases and tables, as well as how to display the existing databases, tables, columns, and data of our MySQL instance.

After creating the database and tables, we will insert data into the two tables we are creating in this recipe.

Note

We are using a primary to foreign key relationship to connect the data of the two tables.

We will go into the details of how this works in the following two recipes, where we modify and delete the data in our MySQL database.

Getting ready

This recipe builds on the MySQL database we created in the previous recipe and also shows you how to drop and recreate the GuiDB.

Note

Dropping the database of course ...

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.