DEV Community

Ali Hamza
Ali Hamza

Posted on

Day 93 of Learning MERN Stack

Hello Dev Community! πŸ‘‹

It is officially Day 93 of my 100-day full-stack engineering run! 🎯 We are just 7 days away from completing the ultimate goal. Today was an absolute powerhouse sessionβ€”instead of slowing down, I accelerated and knocked down 5 advanced SQL challenges on HackerRank in a single day!

From intricate bi-directional string exclusions using NOT REGEXP to building multi-layered recursive-like node diagnostics using conditional CASE engines, today’s problems tested every angle of my query performance knowledge.


🧠 Shifting into Top Gear: A Deep Dive into Today's Submissions

Here is how I organized and optimized my 5 structural code scripts locally before running execution runs:

1 & 2. Severe Text Exclusion Control (Station 11 & 12 Series)

  • The Goal: Query records that completely exclude targeted characters at both extreme boundary ends.
  • The Code (As tracked in "Screenshot (203).png" & "Screenshot (204).png"):

sql
-- Strict Intersect Exclusion
SELECT DISTINCT CITY FROM STATION 
WHERE CITY NOT REGEXP "^(A|E|I|O|U)" 
AND CITY NOT REGEXP "(A|E|I|O|U)$";SELECT * FROM (select id, name, marks, substr(name, -3) as three from student) AS tab
WHERE marks > 75
ORDER BY three ASC, id ASC;SELECT N,
CASE 
    WHEN P IS NULL THEN "Root"
    WHEN EXISTS (SELECT 1 FROM BST AS child WHERE child.P = parent.N) THEN "Inner"
    ELSE "Leaf"
END
FROM BST AS parent ORDER BY N;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)