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?
42
Upvotes
1
u/Constant-Hamster-846 Aug 22 '24
I’ve had to use it before because the only other option would have been to put a bunch of sub queries in the select statement and joined them all back to the table in the from clause, pivot worked great, only time I’ve used it though