Загрузка данных


SELECT 
    AVG(Customer.age) AS average_age
FROM (
    SELECT DISTINCT Customer.customer_key, Customer.age
    FROM Purchase
    JOIN Product ON Purchase.product_key = Product.product_key
    JOIN Customer ON Purchase.customer_key = Customer.customer_key
    WHERE Product.name = 'Smartwatch' 
      AND YEAR(Purchase.date) = 2024
) AS unique_customers;