SlideShare a Scribd company logo
Question: Write a query that displays the order ID, account ID, and total dollar amount for
all the orders, sorted first by the account ID (in ascending order), and then by the total
amount (in descending order).
Answer:
Question: Pulls the first 5 rows and all columns from the orders table that have a dollar amount o f
gloss_amt_usd greater than or equal to 1000.
Answer:
Question: Filter the accounts table to include the company name, website, and the primary point of
contact (primary_poc) just for the Exxon Mobil company in the accounts table.
Answer:
Questions: Create a column that divides the standard_amt_usd by the standard_qty to find the unit
price for standard paper for each order. Limit the results to the first 10 orders, and include
the id and account_id fields.
Answer:
Question: All the companies whose names start with 'C'.
Answer:
Question: All companies whose names contain the string 'one' somewhere in the name.
Answer:
Question: All companies whose names end with 's'.
Answer:
Question: Use the web_events table to find all information regarding individuals who were
contacted via the channel of organic or adwords.
Answer:
Question: Write a query that returns all the orders where the standard_qty is over 1000,
the poster_qty is 0, and the gloss_qty is 0.
Answer:
Question: When you use the BETWEEN operator in SQL, do the results include the values of your
endpoints, or not? Figure out the answer to this important question by writing a query that displays
the order date and gloss_qty data for all orders where gloss_qty is between 24 and 29. Then look
at your output to see if the BETWEEN operator included the begin and end values or not.
Answer:
Question: You will notice that using BETWEEN is tricky for dates! While BETWEEN is generally
inclusive of endpoints, it assumes the time is at 00:00:00 (i.e. midnight) for dates. This is the reason
why we set the right-side endpoint of the period at '2017-01-01'.
Answer:
Question: Write a query that returns a list of orders where the standard_qty is zero and either
the gloss_qty or poster_qty is over 1000.
Answer:
Question: Find all the company names that start with a 'C' or 'W', and the primary
contact contains 'ana' or 'Ana', but it doesn't contain 'eana'.
Answer:
Question: Try pulling standard_qty, gloss_qty, and poster_qty from the orders table, and
the website and the primary_poc from the accounts table.
Answer:
ERD diagram:
Question: Provide a table for all web_events associated with account name of Walmart. There
should be three columns. Be sure to include the primary_poc, time of the event, and the channel for
each event. Additionally, you might choose to add a fourth column to assure only Walmart events
were chosen.
Answer:
Question: Provide the name for each region for every order, as well as the account name and
the unit price they paid (total_amt_usd/total) for the order. Your final table should have 3
columns: region name, account name, and unit price. A few accounts have 0 for total, so I divided
by (total + 0.01) to assure not dividing by zero.
Answer:
Question: Provide a table that provides the region for each sales_rep along with their
associated accounts. This time only for accounts where the sales rep has a first name starting
with S and in the Midwest region. Your final table should include three columns: the region name,
the sales rep name, and the account name. Sort the accounts alphabetically (A-Z) according to
account name.
Answer:
1.
Question: Provide the name for each region for every order, as well as the account name and
the unit price they paid (total_amt_usd/total) for the order. However, you should only provide the
results if the standard order quantity exceeds 100 and the poster order quantity exceeds 50.
Your final table should have 3 columns: region name, account name, and unit price. Sort for the
smallest unit price first. In order to avoid a division by zero error, adding .01 to the denominator
here is helpful (total_amt_usd/(total+0.01).
Answer:
Question: What are the different channels used by account id 1001? Your final table should have
only 2 columns: account name and the different channels. You can try SELECT DISTINCT to
narrow down the results to only the unique values.
Answer:
Question: Find all the orders that occurred in 2015. Your final table should have 4
columns: occurred_at, account name, order total, and order total_amt_usd.
Answer:
Question: Find the total amount spent on standard_amt_usd and gloss_amt_usd paper for
each order in the orders table. This should give a dollar amount for each order in the table.
Answer:
Question : Find the mean (AVERAGE) amount spent per order on each paper type, as well
as the mean amount of each paper type purchased per order. Your final answer should have
6 values - one for each paper type for the average number of sales, as well as the average
amount.
Answer:
Question: Who was the primary contact associated with the earliest web_event?
Answer:
Question: What was the smallest order placed by each account in terms of total usd.
Provide only two columns - the account name and the total usd. Order from smallest dollar
amounts to largest
Answer:
Question: Find the number of sales reps in each region. Your final table should have two
columns - the region and the number of sales_reps. Order from fewest reps to most reps.
Answer:
Question: Determine the number of times a particular channel was used in
the web_events table for each region. Your final table should have three columns -
the region name, the channel, and the number of occurrences. Order your table with the
highest number of occurrences first.
Answer:
Question : How many of the sales reps have more than 5 accounts that they manage?
Answer:
Question : How many accounts have more than 20 orders?
Answer:
Question: Which account has the most orders?
Answer:
Question : How many accounts spent more than 30,000 usd total across all orders?
Answer :
Question : How many accounts spent less than 1,000 usd total across all orders?
Answer :
Question : Which account has spent the most with us?
Answer :
Question : Which accounts used facebook as a channel to contact customers more than 6
times?
Answer :
Question : Which account used facebook most as a channel?
Answer:
Question : Which channel was most frequently used by most accounts?
Answer :
Question : Find the sales in terms of total dollars for all orders in each year, ordered from
greatest to least. Do you notice any trends in the yearly sales totals?
Answer :
Question : In which month of which year did Walmart spend the most on gloss paper in
terms of dollars?
Answer:
Question : We would now like to perform a similar calculation to the first, but we want to
obtain the total amount spent by customers only in 2016 and 2017. Keep the same levels as
in the previous question. Order with the top spending customers listed first.
Answer :
Question : The previous didn't account for the middle, nor the dollar amount associated
with the sales. Management decides they want to see these characteristics represented as
well. We would like to identify top performing sales reps, which are sales reps associated
with more than 200 orders or more than 750000 in total sales. The middle group has
any rep with more than 150 orders or 500000 in sales. Create a table with the sales rep
name, the total number of orders, total sales across all orders, and a column
with top, middle, or low depending on this criteria. Place the top sales people based on
dollar amount of sales first in your final table.
Answer :
Question : Provide the name of the sales_rep in each region with the largest amount
of total_amt_usd sales.
Answer:
First, I wanted to find the total_amt_usd totals associated with each sales rep, and I also
wanted the region in which they were located. The query below provided this information.
Next, I pulled the max for each region, and then we can use this to pull those rows in
our final result.
Essentially, this is a JOIN of these two tables, where the region and amount match.
Question : How many accounts had more total purchases than the account name which
has bought the most standard_qty paper throughout their lifetime as a customer?
Answer :
First, we want to find the account that had the most standard_qty paper. The query here
pulls that account, as well as the total amount:
Now, I want to use this to pull all the accounts with more total sales:
This is now a list of all the accounts with more total orders. We can get the count with just
another simple subquery.
Question : For the customer that spent the most (in total over their lifetime as a
customer) total_amt_usd, how many web_events did they have for each channel.
Answer :
Here, we first want to pull the customer with the most spent in lifetime value.
Now, we want to look at the number of events on each channel this company had, which we
can match with just the id.
Question : What is the lifetime average amount spent in terms of total_amt_usd for the top
10 total spending accounts?
Answer :
First, we just want to find the top 10 accounts in terms of highest total_amt_usd.
Now, we just want the average of these 10 amounts.
Question : What is the lifetime average amount spent in terms of total_amt_usd, including
only the companies that spent more per order, on average, than the average of all orders.
Answer :
First, we want to pull the average of all accounts in terms of total_amt_usd
Then, we want to only pull the accounts with more than this average amount.
Finally, we just want the average of these values
Question : There are 350 company names that start with a letter and 1 that starts with a
number. This gives a ratio of 350/351 that are company names that start with a letter or
99.7%.
Answer :
Question : There are 80 company names that start with a vowel and 271 that start with
other characters. Therefore 80/351 are vowels or 22.8%. Therefore, 77.2% of company
names do not start with vowels.
Answer:
Question : Use the accounts table to create first and last name columns that hold the first and last
names for the primary_poc
Answer :
Question : We would also like to create an initial password, which they will change after
their first log in. The first password will be the first letter of the primary_poc's first name
(lowercase), then the last letter of their first name (lowercase), the first letter of their last
name (lowercase), the last letter of their last name (lowercase), the number of letters in
their first name, the number of letters in their last name, and then the name of the company
they are working with, all capitalized with no spaces.
Answer:
Question : Use the NTILE functionality to divide the accounts into 4 levels in terms of the
amount of standard_qty for their orders. Your resulting table should have the account_id,
the occurred_at time for each order, the total amount of standard_qty paper purchased,
and one of four levels in a standard_quartile column.
Answer :
Question : Use the NTILE functionality to divide the accounts into two levels in terms of the
amount of gloss_qty for their orders. Your resulting table should have the account_id,
the occurred_at time for each order, the total amount of gloss_qty paper purchased, and
one of two levels in a gloss_half column.
Answer :
Question : What is the relationship
between accounts.primary_poc and sales_reps.name?
Answer:
portfolio for data analytics.pdf

More Related Content

Similar to portfolio for data analytics.pdf

De vry math 399 ilabs & discussions latest 2016
De vry math 399 ilabs & discussions latest 2016De vry math 399 ilabs & discussions latest 2016
De vry math 399 ilabs & discussions latest 2016
lenasour
 
De vry math 399 ilabs & discussions latest 2016 november
De vry math 399 ilabs & discussions latest 2016 novemberDe vry math 399 ilabs & discussions latest 2016 november
De vry math 399 ilabs & discussions latest 2016 november
lenasour
 
FIN 540 WRITE-UP QUESTIONS FOR THE TANPIN KANRI CASE/ TUTORIALOUTLET DOT COM
FIN 540 WRITE-UP QUESTIONS FOR THE TANPIN KANRI CASE/ TUTORIALOUTLET DOT COMFIN 540 WRITE-UP QUESTIONS FOR THE TANPIN KANRI CASE/ TUTORIALOUTLET DOT COM
FIN 540 WRITE-UP QUESTIONS FOR THE TANPIN KANRI CASE/ TUTORIALOUTLET DOT COM
alber22po
 
As with all projects in this course, your program’s output wil.docx
As with all projects in this course, your program’s output wil.docxAs with all projects in this course, your program’s output wil.docx
As with all projects in this course, your program’s output wil.docx
randymartin91030
 
De vry math 399 all ilabs latest 2016 november
De vry math 399 all ilabs latest 2016 novemberDe vry math 399 all ilabs latest 2016 november
De vry math 399 all ilabs latest 2016 november
lenasour
 
Cte math test_answer_key
Cte math test_answer_keyCte math test_answer_key
Cte math test_answer_key
navajomath
 
Link to Coffee Shop-- httpextmedia.kaplan.edubusinessMediaAB.docx
Link to Coffee Shop-- httpextmedia.kaplan.edubusinessMediaAB.docxLink to Coffee Shop-- httpextmedia.kaplan.edubusinessMediaAB.docx
Link to Coffee Shop-- httpextmedia.kaplan.edubusinessMediaAB.docx
SHIVA101531
 
Statement of Operations and Financial StatementsSubmit written r.docx
Statement of Operations and Financial StatementsSubmit written r.docxStatement of Operations and Financial StatementsSubmit written r.docx
Statement of Operations and Financial StatementsSubmit written r.docx
whitneyleman54422
 
Week 5 & 6 Query Project  Open the CUSTOMER file .docx
Week 5 & 6 Query Project    Open the CUSTOMER file  .docxWeek 5 & 6 Query Project    Open the CUSTOMER file  .docx
Week 5 & 6 Query Project  Open the CUSTOMER file .docx
melbruce90096
 
Cte math test
Cte math testCte math test
Cte math test
navajomath
 

Similar to portfolio for data analytics.pdf (11)

De vry math 399 ilabs & discussions latest 2016
De vry math 399 ilabs & discussions latest 2016De vry math 399 ilabs & discussions latest 2016
De vry math 399 ilabs & discussions latest 2016
 
De vry math 399 ilabs & discussions latest 2016 november
De vry math 399 ilabs & discussions latest 2016 novemberDe vry math 399 ilabs & discussions latest 2016 november
De vry math 399 ilabs & discussions latest 2016 november
 
FIN 540 WRITE-UP QUESTIONS FOR THE TANPIN KANRI CASE/ TUTORIALOUTLET DOT COM
FIN 540 WRITE-UP QUESTIONS FOR THE TANPIN KANRI CASE/ TUTORIALOUTLET DOT COMFIN 540 WRITE-UP QUESTIONS FOR THE TANPIN KANRI CASE/ TUTORIALOUTLET DOT COM
FIN 540 WRITE-UP QUESTIONS FOR THE TANPIN KANRI CASE/ TUTORIALOUTLET DOT COM
 
As with all projects in this course, your program’s output wil.docx
As with all projects in this course, your program’s output wil.docxAs with all projects in this course, your program’s output wil.docx
As with all projects in this course, your program’s output wil.docx
 
De vry math 399 all ilabs latest 2016 november
De vry math 399 all ilabs latest 2016 novemberDe vry math 399 all ilabs latest 2016 november
De vry math 399 all ilabs latest 2016 november
 
Cte math test_answer_key
Cte math test_answer_keyCte math test_answer_key
Cte math test_answer_key
 
Link to Coffee Shop-- httpextmedia.kaplan.edubusinessMediaAB.docx
Link to Coffee Shop-- httpextmedia.kaplan.edubusinessMediaAB.docxLink to Coffee Shop-- httpextmedia.kaplan.edubusinessMediaAB.docx
Link to Coffee Shop-- httpextmedia.kaplan.edubusinessMediaAB.docx
 
Statement of Operations and Financial StatementsSubmit written r.docx
Statement of Operations and Financial StatementsSubmit written r.docxStatement of Operations and Financial StatementsSubmit written r.docx
Statement of Operations and Financial StatementsSubmit written r.docx
 
Graded assign. inv. 3 4edit
Graded assign. inv. 3 4editGraded assign. inv. 3 4edit
Graded assign. inv. 3 4edit
 
Week 5 & 6 Query Project  Open the CUSTOMER file .docx
Week 5 & 6 Query Project    Open the CUSTOMER file  .docxWeek 5 & 6 Query Project    Open the CUSTOMER file  .docx
Week 5 & 6 Query Project  Open the CUSTOMER file .docx
 
Cte math test
Cte math testCte math test
Cte math test
 

Recently uploaded

Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Subhajit Sahu
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
enxupq
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Boston Institute of Analytics
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
vcaxypu
 
standardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhstandardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghh
ArpitMalhotra16
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
slg6lamcq
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Linda486226
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
ukgaet
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
slg6lamcq
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
nscud
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
ocavb
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
enxupq
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
axoqas
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
AbhimanyuSinha9
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
nscud
 

Recently uploaded (20)

Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
 
standardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhstandardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghh
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
 

portfolio for data analytics.pdf

  • 1. Question: Write a query that displays the order ID, account ID, and total dollar amount for all the orders, sorted first by the account ID (in ascending order), and then by the total amount (in descending order). Answer: Question: Pulls the first 5 rows and all columns from the orders table that have a dollar amount o f gloss_amt_usd greater than or equal to 1000. Answer:
  • 2. Question: Filter the accounts table to include the company name, website, and the primary point of contact (primary_poc) just for the Exxon Mobil company in the accounts table. Answer:
  • 3. Questions: Create a column that divides the standard_amt_usd by the standard_qty to find the unit price for standard paper for each order. Limit the results to the first 10 orders, and include the id and account_id fields. Answer: Question: All the companies whose names start with 'C'. Answer:
  • 4. Question: All companies whose names contain the string 'one' somewhere in the name. Answer: Question: All companies whose names end with 's'. Answer:
  • 5. Question: Use the web_events table to find all information regarding individuals who were contacted via the channel of organic or adwords. Answer: Question: Write a query that returns all the orders where the standard_qty is over 1000, the poster_qty is 0, and the gloss_qty is 0. Answer:
  • 6. Question: When you use the BETWEEN operator in SQL, do the results include the values of your endpoints, or not? Figure out the answer to this important question by writing a query that displays the order date and gloss_qty data for all orders where gloss_qty is between 24 and 29. Then look at your output to see if the BETWEEN operator included the begin and end values or not. Answer: Question: You will notice that using BETWEEN is tricky for dates! While BETWEEN is generally inclusive of endpoints, it assumes the time is at 00:00:00 (i.e. midnight) for dates. This is the reason why we set the right-side endpoint of the period at '2017-01-01'.
  • 7. Answer: Question: Write a query that returns a list of orders where the standard_qty is zero and either the gloss_qty or poster_qty is over 1000. Answer: Question: Find all the company names that start with a 'C' or 'W', and the primary contact contains 'ana' or 'Ana', but it doesn't contain 'eana'.
  • 8. Answer: Question: Try pulling standard_qty, gloss_qty, and poster_qty from the orders table, and the website and the primary_poc from the accounts table. Answer: ERD diagram:
  • 9. Question: Provide a table for all web_events associated with account name of Walmart. There should be three columns. Be sure to include the primary_poc, time of the event, and the channel for each event. Additionally, you might choose to add a fourth column to assure only Walmart events were chosen. Answer:
  • 10. Question: Provide the name for each region for every order, as well as the account name and the unit price they paid (total_amt_usd/total) for the order. Your final table should have 3 columns: region name, account name, and unit price. A few accounts have 0 for total, so I divided by (total + 0.01) to assure not dividing by zero. Answer: Question: Provide a table that provides the region for each sales_rep along with their associated accounts. This time only for accounts where the sales rep has a first name starting with S and in the Midwest region. Your final table should include three columns: the region name, the sales rep name, and the account name. Sort the accounts alphabetically (A-Z) according to account name.
  • 11. Answer: 1. Question: Provide the name for each region for every order, as well as the account name and the unit price they paid (total_amt_usd/total) for the order. However, you should only provide the results if the standard order quantity exceeds 100 and the poster order quantity exceeds 50. Your final table should have 3 columns: region name, account name, and unit price. Sort for the smallest unit price first. In order to avoid a division by zero error, adding .01 to the denominator here is helpful (total_amt_usd/(total+0.01). Answer:
  • 12. Question: What are the different channels used by account id 1001? Your final table should have only 2 columns: account name and the different channels. You can try SELECT DISTINCT to narrow down the results to only the unique values. Answer: Question: Find all the orders that occurred in 2015. Your final table should have 4 columns: occurred_at, account name, order total, and order total_amt_usd. Answer:
  • 13. Question: Find the total amount spent on standard_amt_usd and gloss_amt_usd paper for each order in the orders table. This should give a dollar amount for each order in the table. Answer: Question : Find the mean (AVERAGE) amount spent per order on each paper type, as well as the mean amount of each paper type purchased per order. Your final answer should have 6 values - one for each paper type for the average number of sales, as well as the average amount.
  • 14. Answer: Question: Who was the primary contact associated with the earliest web_event? Answer: Question: What was the smallest order placed by each account in terms of total usd. Provide only two columns - the account name and the total usd. Order from smallest dollar amounts to largest Answer:
  • 15. Question: Find the number of sales reps in each region. Your final table should have two columns - the region and the number of sales_reps. Order from fewest reps to most reps. Answer: Question: Determine the number of times a particular channel was used in the web_events table for each region. Your final table should have three columns - the region name, the channel, and the number of occurrences. Order your table with the highest number of occurrences first.
  • 16. Answer: Question : How many of the sales reps have more than 5 accounts that they manage? Answer: Question : How many accounts have more than 20 orders? Answer:
  • 17. Question: Which account has the most orders? Answer: Question : How many accounts spent more than 30,000 usd total across all orders? Answer :
  • 18. Question : How many accounts spent less than 1,000 usd total across all orders? Answer : Question : Which account has spent the most with us?
  • 19. Answer : Question : Which accounts used facebook as a channel to contact customers more than 6 times? Answer :
  • 20. Question : Which account used facebook most as a channel? Answer: Question : Which channel was most frequently used by most accounts? Answer :
  • 21. Question : Find the sales in terms of total dollars for all orders in each year, ordered from greatest to least. Do you notice any trends in the yearly sales totals? Answer : Question : In which month of which year did Walmart spend the most on gloss paper in terms of dollars? Answer:
  • 22. Question : We would now like to perform a similar calculation to the first, but we want to obtain the total amount spent by customers only in 2016 and 2017. Keep the same levels as in the previous question. Order with the top spending customers listed first. Answer : Question : The previous didn't account for the middle, nor the dollar amount associated with the sales. Management decides they want to see these characteristics represented as well. We would like to identify top performing sales reps, which are sales reps associated with more than 200 orders or more than 750000 in total sales. The middle group has any rep with more than 150 orders or 500000 in sales. Create a table with the sales rep name, the total number of orders, total sales across all orders, and a column with top, middle, or low depending on this criteria. Place the top sales people based on dollar amount of sales first in your final table. Answer :
  • 23. Question : Provide the name of the sales_rep in each region with the largest amount of total_amt_usd sales. Answer: First, I wanted to find the total_amt_usd totals associated with each sales rep, and I also wanted the region in which they were located. The query below provided this information. Next, I pulled the max for each region, and then we can use this to pull those rows in our final result.
  • 24. Essentially, this is a JOIN of these two tables, where the region and amount match.
  • 25. Question : How many accounts had more total purchases than the account name which has bought the most standard_qty paper throughout their lifetime as a customer? Answer : First, we want to find the account that had the most standard_qty paper. The query here pulls that account, as well as the total amount: Now, I want to use this to pull all the accounts with more total sales: This is now a list of all the accounts with more total orders. We can get the count with just another simple subquery.
  • 26. Question : For the customer that spent the most (in total over their lifetime as a customer) total_amt_usd, how many web_events did they have for each channel. Answer : Here, we first want to pull the customer with the most spent in lifetime value. Now, we want to look at the number of events on each channel this company had, which we can match with just the id.
  • 27. Question : What is the lifetime average amount spent in terms of total_amt_usd for the top 10 total spending accounts? Answer : First, we just want to find the top 10 accounts in terms of highest total_amt_usd. Now, we just want the average of these 10 amounts.
  • 28. Question : What is the lifetime average amount spent in terms of total_amt_usd, including only the companies that spent more per order, on average, than the average of all orders. Answer : First, we want to pull the average of all accounts in terms of total_amt_usd Then, we want to only pull the accounts with more than this average amount.
  • 29. Finally, we just want the average of these values Question : There are 350 company names that start with a letter and 1 that starts with a number. This gives a ratio of 350/351 that are company names that start with a letter or 99.7%. Answer :
  • 30. Question : There are 80 company names that start with a vowel and 271 that start with other characters. Therefore 80/351 are vowels or 22.8%. Therefore, 77.2% of company names do not start with vowels. Answer: Question : Use the accounts table to create first and last name columns that hold the first and last names for the primary_poc Answer :
  • 31. Question : We would also like to create an initial password, which they will change after their first log in. The first password will be the first letter of the primary_poc's first name (lowercase), then the last letter of their first name (lowercase), the first letter of their last name (lowercase), the last letter of their last name (lowercase), the number of letters in their first name, the number of letters in their last name, and then the name of the company they are working with, all capitalized with no spaces. Answer:
  • 32. Question : Use the NTILE functionality to divide the accounts into 4 levels in terms of the amount of standard_qty for their orders. Your resulting table should have the account_id, the occurred_at time for each order, the total amount of standard_qty paper purchased, and one of four levels in a standard_quartile column. Answer : Question : Use the NTILE functionality to divide the accounts into two levels in terms of the amount of gloss_qty for their orders. Your resulting table should have the account_id, the occurred_at time for each order, the total amount of gloss_qty paper purchased, and one of two levels in a gloss_half column. Answer :
  • 33. Question : What is the relationship between accounts.primary_poc and sales_reps.name? Answer: