Here is the SQL question: HOW MANY TOTAL SALES ARE COMPLETED EACH MONTH? If I replace 1 with salesdt, then the output wi

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Here is the SQL question: HOW MANY TOTAL SALES ARE COMPLETED EACH MONTH? If I replace 1 with salesdt, then the output wi

Post by answerhappygod »

Here is the SQL question: HOW MANY TOTAL SALES ARECOMPLETED EACH MONTH?
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 1
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 1 (63.99 KiB) Viewed 23 times
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 2
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 2 (11.86 KiB) Viewed 23 times
If I replace 1 with salesdt, then the outputwill change:
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 3
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 3 (10.7 KiB) Viewed 23 times
Sales will be counted separately and won't aggregate bymonth? Can someone explain here, since date_trunc onlycaptures month?It shouldn't have any effect on source column salesdt, nor does itaffect the aggregation of the output? I will upvote you if youcan answer in detail, not just in a few sentences. Thanks.
salesdt descr cost prc The date that the particular sales occurred A description of the item sold. The cost of the item (in cents). The price of the item (in cents).
date_trunc('month', salesdt), sum (prc) from sp.mast group by 1 order by 1 line 10, column 1, location 18 date_trunc 1 2013-01-01 00:00:00+00 2 2013-02-01 00:00:00+00 3 2013-03-01 00:00:00+00 4 2013-04-01 00:00:00+00 sum 9583179 12830204 17783417 20399001
Select date_trunc('month', salesdt), sum (prc) from sp.mast group by salesdt order by salesdt G line 19, column 1, location 36 date_trunc 1 2013-01-01 00:00:00+00 2 2013-01-01 00:00:00+00 3 2013-01-01 00:00:00+00 sum 215955 108301 91318
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply