¿Cómo adaptarías esta consulta para obtener estadísticas de costo e impresión por supply_source (fuente de suministro)? SELECT device_type, operating_system, SUM(total_cost)/100000 AS total_cost_dollars, ((SUM(total_cost)/100000)/SUM(impressions))*1000 AS avg_cpm, SUM(impressions) AS impressions FROM dsp_impressions GROUP BY 1,2
Elige una respuesta
Toca una opción para verificar tu respuesta.
Respuesta correcta: SELECT supply_source, SUM(total_cost)/100000 AS total_cost_dollars, ((SUM(total_cost)/100000)/SUM(impressions))*1000 AS avg_cpm, SUM(impressions) AS impressions FROM dsp_impressions GROUP BY 1.
Por qué esta es la respuesta
The correct answer modifies the original query to group by supplysource instead of devicetype and operatingsystem. The SELECT statement is updated to include supplysource as the primary dimension, and the GROUP BY clause is changed to GROUP BY 1 to aggregate results solely by the first selected column, supplysource. The calculations for totalcostdollars, avgcpm, and impressions remain the same as they correctly calculate the desired metrics. The first incorrect option includes GROUP BY 1,2, which would group by supplysource and an undefined second column, leading to an error or unexpected results. The second incorrect option uses dspinventory instead of dspimpressions as the source table, which may not contain the necessary impression data, and also incorrectly divides totalcost by 100,000,000 instead of 100,000.
Aprueba tu examen — sin la interminable búsqueda de respuestas
Obtén todas las preguntas y explicaciones verificadas para este examen en un solo lugar, y ahorra horas de preparación. Más de 1,000 certificaciones · Más de 20 idiomas · Empieza gratis.
Aprueba tu examen más rápido → No se requiere tarjeta