Build a Contact Book
Advanced · Write the code · from Python SQLite: Build and Query Databases Without a Server
From the lesson: Python SQLite: Build and Query Databases Without a Server
Every app needs to store data somewhere. A to-do list needs to remember your tasks. A contacts app needs to save names and phone numbers. You could write everything to a text file, but what happens when you need to find all contacts in a specific city, or delete tasks older than a week?
Read the lessonBuild a mini contact book that performs all CRUD operations. Create a contacts table with name (TEXT) and phone (TEXT). Insert: Alice (555-0001), Bob (555-0002), Charlie (555-0003). Update Bob's phone to 555-9999. Delete Charlie. Then print all remaining contacts in the format name: phone, followed by a blank line and the total count in the format Total: N contacts.
More SQLite exercises
- Create a Students TableIntermediate
- Filter Products by PriceIntermediate
- Predict the Query ResultIntermediate
- Manage an InventoryIntermediate
- Fix the SQL Injection BugIntermediate
All Python exercises · 50 practice problems · Standard Library Essentials quiz