SQL tricky Complex Query | (Reset Running Total When negative) / (Reset based on column value)

  Рет қаралды 5,672

Learn at Knowstar

Learn at Knowstar

Күн бұрын

In this tutorial, we discuss two tricky scenarios and write SQL Complex Queries to reset running total.
Scenario 1 - Reset when running total is negative
Scenario 2 - Reset based on a column value
The practice data and SQL statements are available here -
know-star.blogs...
Stackoverflow post for related approach -
stackoverflow....
How to calculate running total?
• SQL Query | How to cal...
How to install SQL Server for practice?
• How to install SQL Ser...
Check out the complete list of SQL Query Interview Questions -
• SQL Query Interview Qu...
Best Data Science / Analytics / SQL courses
Learn SQL Basics for Data Science Specialization
imp.i384100.ne...
Beginners to Python Programming
skillshare.eqc...
Data Science and Business Analytics with Python
skillshare.eqc...
Get 40% OFF of Skillshare with code FLASH40 - October 2022
skillshare.eqc...
Data Science Fundamentals with Python and SQL Specialization
imp.i384100.ne...
Python for Everybody Specialization
imp.i384100.ne...
Google Data Analytics Professional Certificate
imp.i384100.ne...
Coursera Plus - Data Science Career Skills
imp.i384100.ne...
Please do not forget to like, subscribe and share.
For enrolling and enquiries, please contact us at
Website - knowstar.org/
Instagram - / learn.knowstar
Facebook - / knowstartrainings
Linkedin - www.linkedin.c...
Email - learn@knowstar.org

Пікірлер: 23
@hbautomation-io
@hbautomation-io 6 ай бұрын
Thank you SO much. Searched the entire internet for this solution..
@LearnatKnowstar
@LearnatKnowstar 6 ай бұрын
Glad it was helpful
@designanddecor8964
@designanddecor8964 2 жыл бұрын
These scenarios are very helpful in real life computations. Please share more such scenarios.
@LearnatKnowstar
@LearnatKnowstar 2 жыл бұрын
Thank you
@fatorx495
@fatorx495 Жыл бұрын
wowwww, i love you! I'm from Brazil and i didn't sleep trying to do this!!! THANK YOU!!!!!!!
@LearnatKnowstar
@LearnatKnowstar Жыл бұрын
Thank you so much for your kind words.
@RanjayKumarSingh-x8l
@RanjayKumarSingh-x8l 9 ай бұрын
Your video is super ... I am struggling since 10 days for this concept but you solved it
@LearnatKnowstar
@LearnatKnowstar 9 ай бұрын
Glad it was helpful.
@kristyowens2284
@kristyowens2284 2 жыл бұрын
This is a nice complex scenario. Thanks for sharing.
@LearnatKnowstar
@LearnatKnowstar 2 жыл бұрын
Thank you
@hv0032113
@hv0032113 2 жыл бұрын
Very good topic. Thanks.
@LearnatKnowstar
@LearnatKnowstar 2 жыл бұрын
🙏
@sravankumar1767
@sravankumar1767 2 жыл бұрын
Nice explanation 👌 👍 👏
@LearnatKnowstar
@LearnatKnowstar 2 жыл бұрын
🙏
@ganeshreddymotakatla6244
@ganeshreddymotakatla6244 2 жыл бұрын
Super explanation...
@LearnatKnowstar
@LearnatKnowstar 2 жыл бұрын
Glad it was helpful 🙏
@harshalpatel3012
@harshalpatel3012 Жыл бұрын
Nice explantion
@LearnatKnowstar
@LearnatKnowstar Жыл бұрын
Thank You
@fatorx495
@fatorx495 Жыл бұрын
thank you
@LearnatKnowstar
@LearnatKnowstar Жыл бұрын
Thank you for your support
@riddlex
@riddlex 2 жыл бұрын
I was asked a question where I have to show only those product_id, product_name where there a constant growth in sales_amount each year. If there is a decline in sales in any year, it shouldn't be included in the output. Let's say the data is from 2011 to 2021. Need to know the approach for this question.
@LearnatKnowstar
@LearnatKnowstar Жыл бұрын
You can first calculate the YoY growth for each product in a CTE. Then you can filter on products for which there is a negative growth in any of the years. In the last step, Select all products where product NOT IN ( the products returned in the negative growth scenario)
@tusharkumbhar5051
@tusharkumbhar5051 Жыл бұрын
Can you please help me
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 822 М.
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 32 МЛН
SQL | Create and Execute Dynamic SQL Query | SQL Injection
19:14
Learn at Knowstar
Рет қаралды 8 М.
Forward Fill Null Values  - 2 WAYS TO SOLVE |  Tricky SQL Questions
11:23
8 Tips & Pointers to solve SQL Complex Queries ! (BONUS Tip Included !)
13:19
Running Total in Power Query
5:09
Doug H
Рет қаралды 7 М.
Calculating A Running Total With SQL
10:10
Seattle Data Guy
Рет қаралды 20 М.
Calculate running total in SQL Server 2012
6:23
kudvenkat
Рет қаралды 128 М.