Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Small and medium teams
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
shreyashji
SQL-Problem-Solving-learning
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
SQL-Problem-Solving-learning
/
11.AK-Pareto Principle Implementation in SQL.sql
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
21 lines (19 loc) · 1.03 KB
master
Breadcrumbs
SQL-Problem-Solving-learning
/
11.AK-Pareto Principle Implementation in SQL.sql
Copy path
Top
File metadata and controls
Code
Blame
21 lines (19 loc) · 1.03 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#Pareto Principle (80/20 Rule) Implementation in SQL
#The pareto principle states that for many outcomes,roughly 80% of consequences come from 20% of causes eg:
#1-80% of productivity come from 20% of the employees
#2-80% of your sales come from 20% of your clients
#3-80% of decision in a meeting are made in 20% of the time
# we are solving the below question
#4-80% of your sales come from 20% of your product or servies
select sum(sales) * 0.8 from superstore_orders; # 80% sales
#167401.6432799999 80% #add the rows and see where its is matching or close to this no.
#so we find running total ,we use window function
with product_wise_sales as
(select Product_ID,sum(sales) as product_sales from superstore_orders
group by Product_ID )
,calc_sales as (
select Product_ID,product_sales
,sum(product_sales) over (order by product_sales desc rows between unbounded preceding and 0 preceding) as running_sales
,0.8*sum(product_sales) over () as total_sales
from product_wise_sales )
select * from calc_sales where running_sales <= total_sales
You can’t perform that action at this time.