Objective
Create a Python program that stores contacts in an SQL table and queries them. Use an in-memory database with the sqlite3 module (sqlite3.connect(":memory:")).
Instructions
- Create the table
contactswith two text columns:nameandphone. - Read an integer
nand thennlines withname phone. Insert all the contacts withexecutemanyand?parameters. - Show
Contacts: kusingSELECT COUNT(*)and then each contact asname: phone, sorted by name (and by phone if the name is repeated).
3
luis 600
ana 611
bea 622
Contacts: 3
ana: 611
bea: 622
luis: 600
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise