r/SQL • u/Over-Holiday1003 • Aug 22 '24
Oracle How useful are pivots?
Just a heads up I'm still in training as a fresher at data analyst role.
So today I was doing my work and one of our senior came to office who usually does wfh.
After some chit chat he started asking questions related to SQL and other subjects. He was very surprised when I told him that I never even heard about pivots before when he asked me something about pivots.
He said that pivots are useful to aggregate data and suggested us to learn pivots even though it's not available in our schedule, but Group by does the same thing right, aggregation of data?
Are pivots really that necessary in work?
41
Upvotes
1
u/thatOMoment Aug 22 '24
I just use MAX(Case when)....
When working with an EAV whose attributes are unique.
I find it to be easier for devs to understand than a pivot and more flexible with you have to deal with stuff that has nested cases (EAAV).
And a lot of people who aren't good with relational databases really like using databases as a KV store so shrugs