▲ 3 r/SolveSQL+1 crossposts

SQL Challenge #1 — Find the Customers Who Came Back 🧩

Let’s start with an interesting one!

You have an orders table:
order_id | customer_id | order_date | amount
---------|-------------|------------|-------
1 | 101 | 2026-01-05 | 500
2 | 102 | 2026-01-07 | 300
3 | 101 | 2026-01-20 | 700
4 | 103 | 2026-02-02 | 400
5 | 102 | 2026-02-10 | 600
6 | 101 | 2026-03-15 | 200
7 | 102 | 2026-03-18 | 800
8 | 103 | 2026-03-25 | 500
9 | 101 | 2026-04-01 | 900

Challenge 🎯
For each customer, find their longest gap in days between two consecutive orders.

Your output should contain:
customer_id
previous_order_date
next_order_date
gap_days

There’s a catch: If a customer has multiple gaps tied for their longest gap, return all of them.

For example, if a customer’s orders were:
Jan 1 → Jan 10 → Jan 19
Both gaps are 9 days, so both should be returned.
Rules
Don’t hardcode customer IDs.
Only compare consecutive orders.
Return all ties.
Try solving it without a self-join. 👀
Bonus: Can you solve it without using a CTE?
Drop your SQL approach below! If someone has already solved it, try finding a different approach. 👇

reddit.com
u/Tiny_Neighborhood536 — 4 days ago
▲ 19 r/swiggy

Sharbati Atta 1 kg for 25 Rs 😨

So i’ve been seeing so many products under noice brand to be very cheap but with cleaner ingredients..

Just wondering how’s this possible? What’s noice able to sell at this price point with same ingredients compared to different brands selling with similar ingredients and 1 kg atta for 25kg just blew my mind that too sharbati atta….

Doubt is how’s this possible? Either it’s just marketing or they’re promoting brand with huge discounts or something else i’m missing?

u/Tiny_Neighborhood536 — 4 days ago

Threadmill for sale

I’m looking to sell my Walkpad Elite which i purchased from Cultfit .
I have purchased this in Jan . Everything in working condition no issues .
I’m looking to sell it for 10k
Got it for 15k

If anyone interested please DM. There’s no issue i still have warranty card and everything. Barely used .

Reason for selling- Not using it

Product Link - https://cult-fit.cultsport.com/walkpadelite-4hp-peak-max-speed-10kmph-max-weight-120kg-with-remote-access-6-months-extended-warranty-only-on-cultsport-com/product/9477

u/Tiny_Neighborhood536 — 11 days ago

Why is protest our default response?

This is something I’ve been thinking about lately.

Whenever something goes wrong—paper leaks, corruption, unfulfilled manifesto promises, policy failures—the first response is often a protest. While peaceful protest is a fundamental democratic right, I wonder whether we’re focusing more on prevention than on a lasting solution.

Our elected representatives take an oath to uphold the Constitution. Shouldn’t they also be held accountable through constitutional and legal mechanisms?
What if, instead of stopping at protests, citizens and civil society:
Documented broken manifesto promises and governance failures.
Collected evidence through RTIs and public data.
Filed PILs or other legal actions where appropriate.
Used constitutional institutions to demand accountability.

A protest says, **“This is wrong.”**

A legal and constitutional challenge asks, **“You had a duty to act. Why didn’t you, and what are the consequences?”**

Protests are important part of any democracy. But should they be the primary response? Or should we invest more effort in evidence-based, constitutional accountability that can lead to enforceable outcomes?
I’m curious to hear what others think.
Are there existing legal mechanisms that citizens are underusing?
What are the biggest barriers to holding governments accountable through constitutional means?
Could strengthening these mechanisms reduce the need for protests over time?

ps - I have used chatgpt to consolidate. please forgive and correct if anything wrong.

reddit.com
u/Tiny_Neighborhood536 — 1 month ago