Activity 01
Pair Programming: Query Builder Challenge
Pairs connect to a sample student database using sqlite3, write a function to execute a SELECT query for marks above 80, and use fetchall() to display results in a formatted table. They test with different conditions and note execution time. Switch roles midway to ensure both contribute.
Explain how to execute SQL SELECT statements and retrieve results in Python.
Facilitation TipDuring Pair Programming, have students swap roles every 5 minutes to keep both partners engaged with query design and execution.
What to look forProvide students with a small SQLite database containing a 'students' table. Ask them to write a Python snippet to fetch and print the name and marks of a single student using `fetchone()`. Then, ask them to fetch and print all students who scored above 75% using `fetchall()`.