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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education