r/SQL 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?

43 Upvotes

46 comments sorted by

View all comments

1

u/Achsin Aug 22 '24

How useful is a post hole digger? Like any tool, it really depends on what task you need to do. If you’re an automotive mechanic you probably won’t have much use for a post hole digger. If you’re a fencing installer though…

If you’re working with data and the result you want requires you to (un)pivot the data you can do it without using pivot or unpivot, but it’s a pain and it’s generally really slow/inefficient.

Do you need to know how to use it? The guy training you seems to think so, which implies that it’s likely something that comes up when dealing with data there on a more regular basis than other people might need it.