Menu
CodeSprout
Typo-tolerant search across every article, problem and post. to open

πŸ”₯ LeetCode SQL: Queries Quality and Percentage | AVG, COUNT, ROUND Explained!

kvi5hnu6 minutes 44 secondsWatch on YouTube
0comments

Notes

πŸš€ In this video, we solve the "Queries Quality and Percentage" problem from LeetCode using AVG, SUM, COUNT, and ROUND in SQL. This is a great problem for practicing aggregation, conditional counting, and percentage calculations in SQL.

πŸ“Œ Solution Approach:
βœ… Calculate query quality using AVG(rating / position)
βœ… Find the percentage of poor queries using SUM(rating lt 3) / COUNT(*) * 100
βœ… Use ROUND to format results to 2 decimal places
βœ… Group results by query_name to categorize the data

πŸ”— LeetCode Problem Link: https://leetcode.com/problems/queries-quality-and-percentage/

πŸ“’ If you found this helpful, don’t forget to LIKE πŸ‘, SUBSCRIBE πŸ””, and COMMENT πŸ’¬! Let’s master SQL together! πŸš€

#SQL #LeetCode #Database #SQLQueries #CodingInterview

Discussion

Sign in to ask a question or share what you learned.