Deleting records

To delete the phone number of an existing contact, we use the following code:

query = 'DELETE FROM contacts WHERE name = ?'self.execute_db_query(query, (name,))

The rest of the code is the supporting GUI. See 9.11_phonebook.py for the complete code. We have now completed coding a basic phone book application.

We have seen how to create a database, add tables to the database, and query the database to add, modify, delete, and view items in the database. Our phone book application has demonstrated how to execute basic CRUD operations on a database.

Furthermore, due to the similarity of basic database operations, you can now consider working with other database systems, such as MySQL, PostgreSQL, Oracle, Ingres, SAP DB, Informix, ...

Get Tkinter GUI Application Development Blueprints - Second Edition 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.