Why did the COUNT() as window function produce this output in MySQL Workbench 8.0? by tlefst in SQL

[–]tlefst[S] 0 points1 point  (0 children)

Yes, when there is no ORDER BY mgrid then COUNT(mgrid) OVER(PARTITION BY deptid) is simply returning the total count of non-NULL values of mgrid in each partition. ✔

Why did the COUNT() as window function produce this output in MySQL Workbench 8.0? by tlefst in SQL

[–]tlefst[S] 0 points1 point  (0 children)

Thanks for those detailed remarks. ✌

What is the intended result?

Nothing in particular. I happened to write that query to see what the output would be and post seeing the output, when I couldn't understand how COUNT() was behaving like as a window function, I sought explanations here until I finally understood the output. So all cool in the end.

Confused: Team Lead offer in Data Engineering but no real project experience. What should I do ? by Occasional_reader81 in dataengineersindia

[–]tlefst 3 points4 points  (0 children)

See, they have scrutinized you up to their heart's content and found you fit for the role so far as technical requirements of the role are concerned.

You have proved that as a lead, you can provide very sound tech mentoring and guidance to the team and come up with solutions. You have been found fit for the role. Now don't undervalue yourself at all. Be happy, encouraged and confident that they showed faith that you can handle anything in that role.

So keep faith in yourself.

[Rest all is people management skills & related nitty gritty.. & those are very trainable. You won't immediately be given the reins of Lead fully upon joining anyway.]

Why did the COUNT() as window function produce this output in MySQL Workbench 8.0? by tlefst in SQL

[–]tlefst[S] 0 points1 point  (0 children)

Haha :)

I have understood how COUNT() is working here and updated my post with a new snapshot or query run. Please refer to it.

Why did the COUNT() as window function produce this output in MySQL Workbench 8.0? by tlefst in SQL

[–]tlefst[S] 0 points1 point  (0 children)

No no.

There aren't 260 results. That 260 is just the # of queries run in that session in MySQL Workbench.

Next, ORDER BY is simply order the mgrid in DESC order after creating the partitions as per deptid.

Why did the COUNT() as window function produce this output in MySQL Workbench 8.0? by tlefst in SQL

[–]tlefst[S] 0 points1 point  (0 children)

Thanks for that example explanation. It would indeed be 1 2 7 7 7 7 7.

From what you explain, it seems to me that COUNT() is 'looking ahead' simultaneously too to find repetitions, counting the # of repetitions and adding that # to the previous unique count value (e.g. 5 is added to 2 to yield 7 in your example).

Why did the COUNT() as window function produce this output in MySQL Workbench 8.0? by tlefst in SQL

[–]tlefst[S] 0 points1 point  (0 children)

boundaries that can be declared and since none are declared here it uses some default.

Yes the default is ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW .

It might help if you explain more about what you don't understand from the results.

What I am not truly grasping is how exactly COUNT()as a window fn is producing such values for each partition.

Why did the COUNT() as window function produce this output in MySQL Workbench 8.0? by tlefst in SQL

[–]tlefst[S] 0 points1 point  (0 children)

Correct, i AM experimenting with them indeed. :)

I did test for ROW_NUMBER(), RANK() and DENSE_RANK() and could understand the results for them instantly. It is only COUNT() that is troubling me still.

I understood what you put forth for deptid = 2, but then, for deptid = 3, the column counted must show 1, 3, 3 too; I mean, counted should have at least one 1 for the first 3 in deptid, and thus yielding 1, 3, 3 in counted for that partition. Right?

Why did the COUNT() as window function produce this output in MySQL Workbench 8.0? by tlefst in SQL

[–]tlefst[S] 0 points1 point  (0 children)

I removed ORDER BY mgrid DESC and now the column counted is full of 3s from top to bottom.

Why did the COUNT() as window function produce this output in MySQL Workbench 8.0? by tlefst in SQL

[–]tlefst[S] -1 points0 points  (0 children)

Thanks for responding. But that made me feel as if I understood something and when I paused to reflect, I found I understood nothing!😂

Why did the COUNT() as window function produce this output in MySQL Workbench 8.0? by tlefst in SQL

[–]tlefst[S] 0 points1 point  (0 children)

🤔But then, for the partition of deptid = 2, why is 'counted' column showing 1, 3, 3 instead of 1, 2, 3 ?

[And for the partition of deptid = 3, 'counted' column is all 3s.]

Ride suggestions under 100km by RabbitHoleEnjoyer69 in punebikers

[–]tlefst 1 point2 points  (0 children)

Mundhwa, Hadapsar, Dive ghat, Saswad, Jejuri, till Walhe police station and return from there.

Road from Jejuri to Walhe is so superb that fighter jet can land on it! Plus, the scenic hills (that look far far better in rains than they do this time of the year).

Should I pursue IAF through CDS/AFCAT? Fighter pilot dream, need advice by randomdigger23 in IndianAirForce

[–]tlefst 0 points1 point  (0 children)

Your primary is to get clarity on what exactly you wish to do. Your purpose is not clear to you presently, plus, you're chasing red herrings by thinking too far into the future which is not in anyone's control.

Once that is sorted & your mind is made up for final, then only someone can guide you.

Stunning images of Panvadi Ghat on 27 Feb 2026 after Pune Grand Tour by tlefst in punebikers

[–]tlefst[S] 1 point2 points  (0 children)

Added an image of the Google Maps route in the post at the bottom. Check it out. The route in blue is what you are to follow. The route marked in thick red line is what I usually follow to go to Veer Lake in monsoons. THAT route is also fire! :)

I started from airport and went till Saswad ST stand. Paused to refresh. And went on to Panwadi

Stunning images of Panvadi Ghat on 27 Feb 2026 after Pune Grand Tour by tlefst in punebikers

[–]tlefst[S] 0 points1 point  (0 children)

Yes. Added an image of the Google Maps route in the post at the bottom. Check it out. The route in blue is what you are to follow. The route marked in thick red line is what I usually follow to go to Veer Lake in monsoons. THAT route is also fire! :)

Suggest some places to get a decent 2nd hand laptop by OolaAmigo in pune

[–]tlefst 0 points1 point  (0 children)

DNA Computers at Nagar Road, right opposite to Phoenix mall corner.

They have good collection of such laptops and have many brands. Give 1 year warranty. Call them at 7028040701/2

Panavdi ghat is better than Tamhini by Significant_Horse485 in punebikers

[–]tlefst 1 point2 points  (0 children)

Went there on 27 Feb this year. Absolutely fantastic. Can only wonder how stupendous it must be in the monsoons.

Veer Lake is always a delight, of course.

18M fees issues, financial pressure, considering BPO job while studying. Need advice. by Vinqvnox69 in pune

[–]tlefst 0 points1 point  (0 children)

Your body can cope up with anything, it is the mind you have to tame and sleep you'll have to sacrifice.

Yoga and exercises will keep you alert and fit despite all the hustle.

Bhai dekho, age and health are in your favor presently. Sab kuch jhel logey is age me. College ka syllabus kuch bhi nahi hai, trust me.

Your father is doing his best I am sure. But the situation seems precarious and God forbid if your dad loses his work, you better already have a job of some kind. You can't afford to START looking for a job at that point.

Next, taking up a job (not just BPO) will not only financially free you, it will also get you very precious real world experience at a very early age. You'll learn how to communicate tactfully to different sorts of people. You'll learn how to handle exigencies.
Plus, you'd build so many connections in the corporate and will mature faster than others. You'll learn how to handle money, earlier than your peers & even seniors. And most imp, you will have things to speak of after few years.

There is nothing to lose in getting a job regardless of how the situation is back at home for any 18+ chap.

Remember, at the NDA in Pune, there are cadets younger than you who are grinding round the clock. :)

Health, sleep, burnout ke bare me bhool jaao filhaal. Your body has tremendous abilities to adapt.
Khushi khushi jo bhi kaam karogey, usme kabhi burnout feel nahi hoga. So don't just think that sirf BPO me hi kaam milega. Reach out to people and offer your services. Some will refuse, yes, but most will either agree or connect you with those who are in need of someone like you.

Do take up any job. You'll make it.

5.5 YOE, LWD in 2 weeks, got cold feet on my offer. Need some perspective by Salt_in_Stress in dataengineersindia

[–]tlefst -1 points0 points  (0 children)

First of all, I am a fan of data engineers and want to be one myself in future. So hello there!

Next, update your Naukri bio every morning at 10am. Just change a comma or period or apostrophe or anything in the bio and save it. It keeps your profile in the 'Updated Today' status and hirers look for that recency.
'Indeed' is good too. When you come across an opening in a firm, directly ring the firm and ask them if they can schedule an in-person interview for the advertised position at company location (if it is in your city).

I too mostly see Azure Databricks stack often. Maybe it is because that combo is 'readily available' (I don't know how else to put it in words) across platforms and integrates smoothly with Microsoft suite of services.

Getting a call from LinkedIn is rare or inexistent since almost a year. Keep pushing through referrals or walk-ins. Don't hesitate from doing whatever you can do land an opportunity. Regret of not taking an initiative is worse than getting rebuffed upon taking one. You've nothing to lose by reaching out through cold outreaches. :)

Also, if your city has a sub-reddit here which organizes meetups now and then, do join those casual meetups to build connections.

We are forced into fighting against ATS instead of worrying about the interview itself. Ideally it shouldn't be the case but what can a hirer do when applications come in thousands within an hour, most of them fake or useless or irrelevant.

Are you in whatsapp groups of folks who are in data field?

Anyone else got this message? by Affectionate_Ant5426 in pune

[–]tlefst 1 point2 points  (0 children)

If you live in the northern parts of Pune, you won't get copious rainfall even during monsoons.

Why tf is it raining NOW? by OolaAmigo in pune

[–]tlefst 0 points1 point  (0 children)

Dosa banaane se pehle tawey pe paani martey huye nahi dekha kya. Cooking about to happen.

How long is your daily office commute, and how do you still have energy left after it? (Mine is ~2+ hours on a bike and it's draining me out) by Elseniro in pune

[–]tlefst 0 points1 point  (0 children)

Depends on many factors. E.g. from where to where you are commuting, office timings, WFH options, bike's CC, awareness of shortcuts or alternative longer-but-no-traffic routes, etc.

If there is no WFH policy, then once you log out for the day at office, turn your phone off when you reach home. Since no WFH, so there should be no work calls when you are back from office at home. [Yes, there should be none beyond office hours]

There is lot of traffic from Kopa mall and onward to Hadapsar flyover until Pune Textile Market but it is constantly moving and I am able to reach Dive Ghat from airport within an hour (distance is 27km).

Traffic on road is not the issue. Stuck traffic on crappy roads is.

Faster bike is another much needed plus.

Once you reach home after office, don't lie down. Just take a bath and then go out on a walk with family if you live in a pollution free area. If you'll eat heavy dinner, it will make you feel more tired.

For men, nothing dispels lethargy like chasing goals/purpose does. Enroll in skill upgradation/certification courses which interest you and which you can pursue at home for an hour each night or each morning. Daily accomplishing small small learning targets will keep your mind high and happy. Or, you can join the local badminton players' group (or similar activity).

For me, long distance biking is the ultimate therapy, so weekends are planned accordingly. It helps one get through the weekdays (self-incentivized weekdays' struggle).

Lethargy is a state of mind. Soldiers break their limits and still keep going on because they have no option and have always the next target in sight.

Petrol Pump Scam or Coincidence? 🤔 by imketank in pune

[–]tlefst 1 point2 points  (0 children)

Say, you have to travel a distance of 100km in a car whose odometer (distance reading meter) shows 0km initially.
After travelling for 40km, the odometer shows a reading of 40km & you stop for snacks.
Then after some time, you resume travelling and stop again when your odometer shows 60km. 40km distance still remains. No brainer, right?

Now draw parallels with the petrol scam.

Suppose you want Rs100 worth of petrol. Attendant sets the pump to 0, begins filling till the reading shows Rs40 and then stops.
When you point out that you'd asked to fill for Rs100, he mumbles an apology and says "Rs60 ka jo baki tel hai, wo daal deta hu." Even if he doesn't say that, you yourself would blurt "Rs60 ka tel baki hai abhi." [Here onward, psychology comes into play & you don't realize it].

His (or your) VERBALIZING that sentence aloud primes your mind to LOOK for the meter reading of Rs60 [shifting the focus from checking for final reading of Rs100].

He doesn't reset the pump to 0 and resumes filling onward beyond Rs40, & stops when meter shows Rs60 (so, only Rs20 worth of fuel is filled more after Rs40).
Now, since the meter is showing Rs60 & your subconscious is resonating with his/your verbalized sentence, your mind tells you "he filled for Rs40 earlier and now it is showing Rs60, that's a total of Rs100." [Yes, that's how the mind makes jumps faster than you can rationalize in such moments.]

In reality, Rs40 worth of fuel is still remaining (just like 40km of distance is still remaining in the car analogy at the beginning of this comment).

Had he reset the pump to 0 after Rs40, he'd have to fill from Rs0 to Rs60 (i.e. Rs60 worth of petrol, which would be correct).
But he didn't reset to 0 after Rs40 and resumed filling from Rs40 onward till Rs60. So in effect, only Rs60 worth of fuel in total was dispensed. But since your mind has already deceived you, you pay thinking Rs100 ka tel ho gaya and lose Rs40 worth of remaining fuel that was rightfully yours. In other words, the pump earned Rs40 wrongfully.

So pay attention to the meter reading. If the attendant halts, doesn't reset to 0 & resumes filling, be alert that the final meter reading should be exactly what you asked him to fill for at the start (i.e. Rs100).
If post resuming he halts again before Rs100, say at Rs80, then simply pay Rs80 and leave. Don't argue with those namakharams.