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;
Top comments (0)