Please write the SQL to return the sale revenue (top line & bottom line) by Marketing channel for the past 90 days trended by day. Please write the SQL to return the number of visits, visitors and bounce rate for each Marketing Channel for the past 90 days trended by day. (Hint: Bounce rate

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter7: Database Administration
Section: Chapter Questions
Problem 4CAT: Write, but do not execute, the commands to grant the following privileges: a. User Rodriquez must be...
icon
Related questions
Question

 

  • Please write the SQL to return the sale revenue (top line & bottom line) by Marketing channel for the past 90 days trended by day.
  • Please write the SQL to return the number of visits, visitors and bounce rate for each Marketing Channel for the past 90 days trended by day. (Hint: Bounce rate = Single page view visits / total visits)

 

SAMPLE TABLES AND METADATA:
Database
Value type
Tables
Columns
Notes
BI_VISIT
Primary Unique Key - ID for individual browsing sessions on website
ID for individuals on website
EDW_ACCESS_VIEWS
VISIT_ID
DECIMAL
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW ACCESS VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
EDW_ACCESS_VIEWS
BI_VISIT
VISITOR_ID
DECIMAL
BI_VISIT
BI VISIT
BI VISIT
VISIT_DT
DATE
Date of visit to website
DECIMAL
Campaign ID for the first webpage a visit views. The campain that drove the visitor to view the website.
A count of pages viewed in a given visit
FIRST_PAGE_VIEW_CAMPAIGN_ID
PAGE_VIEW_COUNT
INTEGER
BI_SALES
BI_SALES
BI_SALES
BI SALES
SALES_TANSACTION_ID
INTEGER
ID for individual sale transactions
SALES_TRANSACTION_LINE_ID
INTEGER
Primary Unique Key - ID for individual items purchased in a sale transaction
SALES_TAANSACTION_CAMPAIGN_ID DECIMAL
REVENUE_TOP_LINE
The last campaign a visit clicked through before the given transaction
DECIMAL
Top line revenue for a transaction
BI_SALES
BI_SALES
BI_SALES
BI SALES
REVENUE_BOTTOM_LINE
DECIMAL
Bottom line revenue for a transaction
ID for individual browsing sessions on website
ID for item purchased
VISIT_ID
DECIMAL
PRODUCT_ID
DECIMAL
DEPARTMENT
SMALLINT
Department of the product in a given transaction
Date of sale
BI_SALES
BI CAMPAIGN DESCRIPTION CAMPAIGN ID
SALES_TRANSACTION_DATE
DATE
DECIMAL
Primary Unique Key - Campaign ID for each marketing campaign run
BI_CAMPAIGN_DESCRIPTION CAMPAIGN_DESCRIPTION
VARCHAR
Description of the campaign
BI CAMPAIGN DESCRIPTION CHANNEL DESCRIPTION
VARCHAR
Marketing channel the cammpaign belongs to
2. Please write the SQL to return the sale revenue (top line & bottom line) by Marketing channel for the past 90 days trended by day.
Transcribed Image Text:SAMPLE TABLES AND METADATA: Database Value type Tables Columns Notes BI_VISIT Primary Unique Key - ID for individual browsing sessions on website ID for individuals on website EDW_ACCESS_VIEWS VISIT_ID DECIMAL EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW ACCESS VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS EDW_ACCESS_VIEWS BI_VISIT VISITOR_ID DECIMAL BI_VISIT BI VISIT BI VISIT VISIT_DT DATE Date of visit to website DECIMAL Campaign ID for the first webpage a visit views. The campain that drove the visitor to view the website. A count of pages viewed in a given visit FIRST_PAGE_VIEW_CAMPAIGN_ID PAGE_VIEW_COUNT INTEGER BI_SALES BI_SALES BI_SALES BI SALES SALES_TANSACTION_ID INTEGER ID for individual sale transactions SALES_TRANSACTION_LINE_ID INTEGER Primary Unique Key - ID for individual items purchased in a sale transaction SALES_TAANSACTION_CAMPAIGN_ID DECIMAL REVENUE_TOP_LINE The last campaign a visit clicked through before the given transaction DECIMAL Top line revenue for a transaction BI_SALES BI_SALES BI_SALES BI SALES REVENUE_BOTTOM_LINE DECIMAL Bottom line revenue for a transaction ID for individual browsing sessions on website ID for item purchased VISIT_ID DECIMAL PRODUCT_ID DECIMAL DEPARTMENT SMALLINT Department of the product in a given transaction Date of sale BI_SALES BI CAMPAIGN DESCRIPTION CAMPAIGN ID SALES_TRANSACTION_DATE DATE DECIMAL Primary Unique Key - Campaign ID for each marketing campaign run BI_CAMPAIGN_DESCRIPTION CAMPAIGN_DESCRIPTION VARCHAR Description of the campaign BI CAMPAIGN DESCRIPTION CHANNEL DESCRIPTION VARCHAR Marketing channel the cammpaign belongs to 2. Please write the SQL to return the sale revenue (top line & bottom line) by Marketing channel for the past 90 days trended by day.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage