As seen below, I have a table called trans. I'm looking for the average time (in minutes) it takes users to pay for their orders in the table.
here is the code I tried:
import duckdb
con = duckdb.connect(database=':memory:')
con.execute("""
--
select member_id, AVG(datediff(minute, order_date, payment_date)) as AverageTime
from trans
where purchase_succesfull = 'Yes'
group by member_id;
""").df()
the code doesn't work, with the error Referenced column "minute" not found in FROM clause!
.
So how to find the average time (in minutes) it takes users to make payment of their orders without any error?
It would be extremely helpful if someone could offer some advice.