DataLeaguebeta

Customer spend in SQL

code25 pts

The variable conn holds a ready SQLite database with the tables customers, orders and order_items (see the code). The spend of one line is qty * unit_price.

Write a query into the variable sql that returns, for every customer, the name (name) and the total spend (spent) across all their orders, but only customers who spent more than 200 €, sorted from the highest spend.

The check runs your query and compares the result; the printout is just for you. The sqlite3 module is part of Python, nothing is downloaded.

Python loads when you first use the editor

The output appears after you run the code.

Run the code and fix the errors until all checks pass.