0% found this document useful (0 votes)
115 views8 pages

SQL

This document is a report on an email campaign analysis that was run on August 3, 2010. It summarizes the SQL queries used to aggregate data from various tables to calculate metrics on email campaigns between July 25-31, 2010. Temporary tables were created to store intermediate results and joined together to produce the final output with campaign performance metrics.

Uploaded by

Sunil Reddy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views8 pages

SQL

This document is a report on an email campaign analysis that was run on August 3, 2010. It summarizes the SQL queries used to aggregate data from various tables to calculate metrics on email campaigns between July 25-31, 2010. Temporary tables were created to store intermediate results and joined together to produce the final output with campaign performance metrics.

Uploaded by

Sunil Reddy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

Report: TY-Weekly Email Campaign Analysis Report (Ready) Job: 9360 Data Rows: 0 Data Columns: 0 Report Cache

Used: No Query Engine Execution Start Time: Query Engine Execution Finish Time: 8/3/2010 7:20:31 AM 8/3/2010 7:20:54 AM

Total Duration in Query Engine: 0:00:23.35 SQL Duration: 0:00:22.12 Analytical Duration: 0:00:00.00 Other Processing Duration in Query Engine: 0:00:01.23 Number of Rows Returned: Number of Columns Returned: Number of Temp Tables: Total Number of Passes: Number of SQL Passes: Number of Analytical Passes: DB User: DB Instance: 0 22 10 31 31 0

vsdp_ncast DW_VSC_DB_VIEW

Tables Accessed: EMAIL_RESPONSE_CLICK_MSI MSI_CALENDAR_REF EMAIL_CONTACT MEDIA EMAIL_ORDER_DEMAND_MSI_FSP CAMPAIGN_MASTER SQL Statements: Pass0 - Duration: 0:00:00.28 create volatile table ZZTF20G0780MD000, no fallback, no log( CELL_ID INTEGER, WJXBFS1 INTEGER) primary index (CELL_ID) on commit preserve rows Pass1 - Duration: 0:00:01.54 ;insert into ZZTF20G0780MD000 select a11.CELL_ID CELL_ID, count(a11.EMAIL_NBR) WJXBFS1

from DB_VIEW.EMAIL_CONTACT a11 where a11.CELL_START_DTE between '07/25/2010' and '07/31/2010' group by a11.CELL_ID Pass2 - Duration: 0:00:00.18 create volatile table ZZTF20G0780MD001, no fallback, no log( CELL_ID INTEGER, WJXBFS1 INTEGER, WJXBFS2 INTEGER) primary index (CELL_ID) on commit preserve rows Pass3 - Duration: 0:00:01.57 ;insert into ZZTF20G0780MD001 select a11.CELL_ID CELL_ID, count(distinct a11.EMAIL_CELL_ID) WJXBFS1, count(a11.EMAIL_CELL_OFFER_ID) WJXBFS2 from DB_VIEW.EMAIL_RESPONSE_CLICK_MSI a11 where a11.CELL_START_DTE between '07/25/2010' and '07/31/2010' group by a11.CELL_ID Pass4 - Duration: 0:00:00.25 create volatile table ZZTF20G0780MD002, no fallback, no log( CELL_ID INTEGER, WJXBFS1 INTEGER) primary index (CELL_ID) on commit preserve rows Pass5 - Duration: 0:00:00.57 ;insert into ZZTF20G0780MD002 select a11.CELL_ID CELL_ID, count(a11.EMAIL_NBR) WJXBFS1 from DB_VIEW.EMAIL_CONTACT a11 where (a11.BOUNCE_FLAG in (1) and a11.CELL_START_DTE between '07/25/2010' and '07/31/2010') group by a11.CELL_ID Pass6 - Duration: 0:00:00.26 create volatile table ZZTF20G0780MD003, no fallback, no log( CELL_ID INTEGER, WJXBFS1 FLOAT, WJXBFS2 FLOAT) primary index (CELL_ID) on commit preserve rows Pass7 - Duration: 0:00:04.98 ;insert into ZZTF20G0780MD003 select a11.CELL_ID CELL_ID, sum(a11.INITIAL_ORDERED_DEMAND) WJXBFS1,

sum(a11.INITIAL_ORDERED_DEMAND) WJXBFS2 from DB_VIEW.EMAIL_ORDER_DEMAND_MSI_FSP a11, DB_VIEW.MEDIA a12, DB_VIEW.CAMPAIGN_MASTER a13 where a11.MEDIA_CDE = a12.MEDIA_CDE and a11.MEDIA_YR = a12.MEDIA_YEAR and a11.CELL_ID = a13.CELL_ID and (((a11.EMAIL_ORDER_NBR) in (select r11.EMAIL_ORDER_NBR from DB_VIEW.EMAIL_ORDER_DEMAND_MSI_FSP DB_VIEW.CAMPAIGN_MASTER r12 where r11.CELL_ID = r12.CELL_ID and r12.CELL_START_DTE >= '07/25/2010')) and a11.ORDER_TYP in ('I') and a12.BOOK_TP_CDE in ('IT') and a13.CELL_START_DTE between '07/25/2010' and '07/31/2010') group by a11.CELL_ID Pass8 - Duration: 0:00:00.23 create volatile table ZZTF20G0780MD004, no fallback, no log( CELL_ID INTEGER, WJXBFS1 FLOAT, WJXBFS2 FLOAT) primary index (CELL_ID) on commit preserve rows Pass9 - Duration: 0:00:01.00 ;insert into ZZTF20G0780MD004 select a11.CELL_ID CELL_ID, sum(a11.INITIAL_ORDERED_DEMAND) WJXBFS1, sum(a11.INITIAL_ORDERED_DEMAND) WJXBFS2 from DB_VIEW.EMAIL_ORDER_DEMAND_MSI_FSP a11, DB_VIEW.MEDIA a12, DB_VIEW.CAMPAIGN_MASTER a13 where a11.MEDIA_CDE = a12.MEDIA_CDE and a11.MEDIA_YR = a12.MEDIA_YEAR and a11.CELL_ID = a13.CELL_ID and (((a11.EMAIL_ORDER_NBR) in (select r11.EMAIL_ORDER_NBR from DB_VIEW.EMAIL_ORDER_DEMAND_MSI_FSP DB_VIEW.CAMPAIGN_MASTER r12 where r11.CELL_ID = r12.CELL_ID and r12.CELL_START_DTE >= '07/25/2010')) and a11.ORDER_TYP in ('I') and a12.BOOK_TP_CDE in ('IC') and a13.CELL_START_DTE between '07/25/2010' and '07/31/2010') group by a11.CELL_ID

r11,

r11,

Pass10 - Duration: 0:00:00.17 create volatile table ZZTF20G0780MD005, no fallback, no log( CELL_ID INTEGER, WJXBFS1 FLOAT, WJXBFS2 FLOAT) primary index (CELL_ID) on commit preserve rows Pass11 - Duration: 0:00:01.01 ;insert into ZZTF20G0780MD005 select a11.CELL_ID CELL_ID, sum(a11.INITIAL_ORDERED_DEMAND) WJXBFS1, sum(a11.INITIAL_ORDERED_DEMAND) WJXBFS2 from DB_VIEW.EMAIL_ORDER_DEMAND_MSI_FSP a11, DB_VIEW.MEDIA a12, DB_VIEW.CAMPAIGN_MASTER a13 where a11.MEDIA_CDE = a12.MEDIA_CDE and a11.MEDIA_YR = a12.MEDIA_YEAR and a11.CELL_ID = a13.CELL_ID and (((a11.EMAIL_ORDER_NBR) in (select r11.EMAIL_ORDER_NBR from DB_VIEW.EMAIL_ORDER_DEMAND_MSI_FSP DB_VIEW.CAMPAIGN_MASTER r12 where r11.CELL_ID = r12.CELL_ID and r12.CELL_START_DTE >= '07/25/2010')) and a11.ORDER_TYP in ('I') and (not a12.BOOK_TP_CDE in ('IT', 'IC')) and a13.CELL_START_DTE between '07/25/2010' and '07/31/2010') group by a11.CELL_ID Pass12 - Duration: 0:00:00.23 create volatile table ZZTF20G0780MD006, no fallback, no log( CELL_ID INTEGER, WJXBFS1 FLOAT, WJXBFS2 FLOAT) primary index (CELL_ID) on commit preserve rows Pass13 - Duration: 0:00:01.35 ;insert into ZZTF20G0780MD006 select a11.CELL_ID CELL_ID, sum(a11.INITIAL_ORDERED_DEMAND) WJXBFS1, sum(a11.INITIAL_ORDERED_DEMAND) WJXBFS2 from DB_VIEW.EMAIL_ORDER_DEMAND_MSI_FSP DB_VIEW.CAMPAIGN_MASTER a12 where a11.CELL_ID = a12.CELL_ID and (((a11.EMAIL_ORDER_NBR)

r11,

a11,

(select r11.EMAIL_ORDER_NBR from DB_VIEW.EMAIL_ORDER_DEMAND_MSI_FSP DB_VIEW.CAMPAIGN_MASTER r12 where r11.CELL_ID = r12.CELL_ID and r12.CELL_START_DTE >= '07/25/2010')) and a11.ORDER_TYP in ('C', 'F', 'M', 'P') and a12.CELL_START_DTE between '07/25/2010' and '07/31/2010') group by a11.CELL_ID Pass14 - Duration: 0:00:00.28 create volatile table ZZTF20G0780MD007, no fallback, no log( CELL_ID INTEGER, WJXBFS1 FLOAT, WJXBFS2 INTEGER) primary index (CELL_ID) on commit preserve rows Pass15 - Duration: 0:00:00.62 ;insert into ZZTF20G0780MD007 select a11.CELL_ID CELL_ID, sum(a11.INITIAL_ORDERED_DEMAND) WJXBFS1, count(distinct a11.EMAIL_ORDER_NBR) WJXBFS2 from DB_VIEW.EMAIL_ORDER_DEMAND_MSI_FSP a11, DB_VIEW.CAMPAIGN_MASTER a12 where a11.CELL_ID = a12.CELL_ID and (a11.ORDER_TYP in ('I') and a12.CELL_START_DTE between '07/25/2010' and '07/31/2010') group by a11.CELL_ID Pass16 - Duration: 0:00:00.21 create volatile table ZZTF20G0780MD008, no fallback, no log( CELL_ID INTEGER, WJXBFS1 INTEGER) primary index (CELL_ID) on commit preserve rows Pass17 - Duration: 0:00:00.65 ;insert into ZZTF20G0780MD008 select a11.CELL_ID CELL_ID, count(distinct a11.EMAIL_ORDER_NBR) WJXBFS1 from DB_VIEW.EMAIL_ORDER_DEMAND_MSI_FSP a11, DB_VIEW.CAMPAIGN_MASTER a12 where a11.CELL_ID = a12.CELL_ID and (a11.ORDER_TYP in ('C', 'F', 'I', 'M', 'P') and a12.CELL_START_DTE between '07/25/2010' and '07/31/2010') group by a11.CELL_ID Pass18 - Duration: 0:00:00.21

in

r11,

create volatile table ZZTF20G0780MD009, no fallback, no log( CELL_ID INTEGER, WJXBFS1 INTEGER) primary index (CELL_ID) on commit preserve rows Pass19 - Duration: 0:00:01.18 ;insert into ZZTF20G0780MD009 select a11.CELL_ID CELL_ID, count(a11.EMAIL_NBR) WJXBFS1 from DB_VIEW.EMAIL_CONTACT a11 where (a11.OPEN_DTE > '01/11/1986' and a11.CELL_START_DTE between '07/25/2010' and '07/31/2010') group by a11.CELL_ID Pass20 - Duration: 0:00:01.32 select distinct a113.C_YR C_YR_MTH, a113.C_YR_MTH C_YR_MTH0, a113.MTH_DESC MTH_DESC, a114.CELL_MAILING CELL_MAILING, a114.CELL_CAMPAIGN CELL_CAMPAIGN, a114.CELL_VERSION CELL_VERSION, coalesce(pa11.CELL_ID, pa12.CELL_ID, pa13.CELL_ID, pa14.CELL_ID, pa15.CELL_ID) CELL_ID, pa16.WJXBFS1 WJXBFS1, pa17.WJXBFS1 WJXBFS2, pa18.WJXBFS1 WJXBFS3, pa19.WJXBFS2 WJXBFS4, pa11.WJXBFS1 WJXBFS5, pa12.WJXBFS1 WJXBFS6, pa13.WJXBFS1 WJXBFS7, pa14.WJXBFS1 WJXBFS8, (((ZEROIFNULL(pa13.WJXBFS2) + ZEROIFNULL(pa14.WJXBFS2)) + ZEROIFNULL(pa12.WJXBFS2)) + ZEROIFNULL(pa11.WJXBFS2)) WJXBFS9, pa110.WJXBFS1 WJXBFSa, ZEROIFNULL(((((ZEROIFNULL(pa13.WJXBFS1) + ZEROIFNULL(pa14.WJXBFS1)) + ZEROIFNULL(pa12.WJXBFS1)) + ZEROIFNULL(pa11.WJXBFS1)) / NULLIFZERO(pa111.WJXBFS1))) WJXBFSb, pa110.WJXBFS2 WJXBFSc, pa15.WJXBFS1 WJXBFSd, (ZEROIFNULL(pa16.WJXBFS1) - ZEROIFNULL(pa18.WJXBFS1)) WJXBFSe, pa111.WJXBFS1 WJXBFSf from ZZTF20G0780MD003 pa11 full outer join ZZTF20G0780MD004 pa12 on (pa11.CELL_ID = pa12.CELL_ID) full outer join ZZTF20G0780MD005 pa13

on (coalesce(pa11.CELL_ID, pa12.CELL_ID) = pa13.CELL_ID) full outer join ZZTF20G0780MD006 pa14 on (coalesce(pa11.CELL_ID, pa12.CELL_ID, pa13.CELL_ID) = pa14.CELL_ID) full outer join ZZTF20G0780MD009 pa15 on (coalesce(pa11.CELL_ID, pa12.CELL_ID, pa13.CELL_ID, pa14.CELL_ID) = pa15.CELL_ID) left outer join ZZTF20G0780MD000 pa16 on (coalesce(pa11.CELL_ID, pa12.CELL_ID, pa13.CELL_ID, pa14.CELL_ID, pa15.CELL_ID) = pa16.CELL_ID) left outer join ZZTF20G0780MD001 pa17 on (coalesce(pa11.CELL_ID, pa12.CELL_ID, pa13.CELL_ID, pa14.CELL_ID, pa15.CELL_ID) = pa17.CELL_ID) left outer join ZZTF20G0780MD002 pa18 on (coalesce(pa11.CELL_ID, pa12.CELL_ID, pa13.CELL_ID, pa14.CELL_ID, pa15.CELL_ID) = pa18.CELL_ID) left outer join ZZTF20G0780MD001 pa19 on (coalesce(pa11.CELL_ID, pa12.CELL_ID, pa13.CELL_ID, pa14.CELL_ID, pa15.CELL_ID) = pa19.CELL_ID) left outer join ZZTF20G0780MD007 pa110 on (coalesce(pa11.CELL_ID, pa12.CELL_ID, pa13.CELL_ID, pa14.CELL_ID, pa15.CELL_ID) = pa110.CELL_ID) left outer join ZZTF20G0780MD008 pa111 on (coalesce(pa11.CELL_ID, pa12.CELL_ID, pa13.CELL_ID, pa14.CELL_ID, pa15.CELL_ID) = pa111.CELL_ID), DB_VIEW.CAMPAIGN_MASTER a114, DB_VIEW.MSI_CALENDAR_REF a113 where coalesce(pa11.CELL_ID, pa12.CELL_ID, pa13.CELL_ID, pa14.CELL_ID, pa15.CELL_ID) = a114.CELL_ID and a114.CELL_START_DTE = a113.VSC_DTE Pass21 - Duration: 0:00:00.60 drop table ZZTF20G0780MD000 Pass22 - Duration: 0:00:00.39 drop table ZZTF20G0780MD001 Pass23 - Duration: 0:00:00.42 drop table ZZTF20G0780MD002 Pass24 - Duration: 0:00:00.34 drop table ZZTF20G0780MD003 Pass25 - Duration: 0:00:00.34 drop table ZZTF20G0780MD004

Pass26 - Duration: 0:00:00.45 drop table ZZTF20G0780MD005 Pass27 - Duration: 0:00:00.32 drop table ZZTF20G0780MD006 Pass28 - Duration: 0:00:00.32 drop table ZZTF20G0780MD007 Pass29 - Duration: 0:00:00.34 drop table ZZTF20G0780MD008 Pass30 - Duration: 0:00:00.35 drop table ZZTF20G0780MD009 [Analytical engine calculation steps: 1. Calculate metric: <$/Email On Line> at original data level 2. Calculate metric: <$/Email Total> at original data level 3. Calculate metric: <Open %> at original data level 4. Calculate metric: <Click %> at original data level 5. Calculate metric: <Conversion %> at original data level 6. Calculate metric: <$/Email Phone> at original data level 7. Calculate subtotal: <Total> 8. Calculate metric: <$/Email On Line> at subtotal levels 9. Calculate metric: <$/Email Total> at subtotal levels 10. Calculate metric: <Open %> at subtotal levels 11. Calculate metric: <Click %> at subtotal levels 12. Calculate metric: <Conversion %> at subtotal levels 13. Calculate metric: <$/Email Phone> at subtotal levels 14. Perform cross-tabbing ]

You might also like