Santiago Moresi

Generation

text to sql syntaxFri, 14 Jul 2023

Del total de clientes que realizaron compras en 2020. Qué porcentaje no había realizado compras en 2019. Tenido la tabla de cliente, compra

SELECT id_customer, COUNT(DISTINCT id_customer) * 100 / (SELECT COUNT(DISTINCT id_customer) FROM sales) FROM sales WHERE year(created_at) = 2020 AND id_customer NOT IN (SELECT id_customer FROM sales WHERE year(created_at) = 2019) GROUP BY id_customer

Want to kickstart your project?Use the new AI Studio to create your code