<prompt> Tuseme una meza inayoitwa invoices na safu invoice_id, mteja_id, invoice_date, na kiasi. Kuandika SQL query kupata juu 5 wateja ambao wana juu wastani kiasi cha ankara, isipokuwa wateja wowote ambao wamefanya chini ya 10 ununuzi.  <response>: Heres a SQL query that should achieve the desired result:SELECT customer_id, AVGamount AS average_invoice_amount, COUNTDISTINCT invoice_id AS num_invoicesFROM invoicesGROUP BY customer_idHAVING num_invoices 10ORDER BY average_invoice_amount DESCLIMIT 5;This SQL query first groups all invoices by customer ID, calculates the average invoice amount and the number of invoices for each customer, and then filters out any customers who have made less than 10 purchases using the HAVING clause. Finally, the results are ordered in descending order based on the average invoice amount and limited to the top 5 results using the LIMIT clause. 