DEV Community

Ali Hamza
Ali Hamza

Posted on

Day 92 of Learning MERN Stack

Hello Dev Community! ๐Ÿ‘‹

It is officially Day 92 of my 100-day backend and database engineering sprint! ๐ŸŽฏ Yesterday, I tackled complex string transformations like "The PADS". Today, I focused heavily on scoped mathematical computations and structural filters on HackerRank by mastering: Targeted Data Aggregations (COUNT and AVG) combined with strict Attribute Filtering! ๐Ÿ“Š๐Ÿ”ข

When building management portals or dashboard systemsโ€”like computing localized vendor counts or evaluating the average rating metrics of a specific categoryโ€”knowing how to scope analytical operations precisely is vital.


๐Ÿง  Unpacking Day 92 Core Problem-Solving Logic

As visible across my script files inside "Screenshot (201).png" and "Screenshot (202).png", I built dedicated sandbox scenarios locally to examine the compilation performance of these metrics:

1. Scoped Volume Tracking: The COUNT Aggregator

  • The Challenge: Query the total number of cities in the CITY table where the district field matches specifically with 'California'.
  • The Code: Instead of loading full row logs, the query optimizes data transfer by executing a high-performance count directly on the indexed elements:

sql
SELECT COUNT(NAME) 
FROM CITY 
WHERE DISTRICT = 'California'; SELECT AVG(POPULATION) 
FROM CITY 
WHERE DISTRICT = 'California';
Enter fullscreen mode Exit fullscreen mode

Top comments (0)