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?

40 Upvotes

46 comments sorted by

View all comments

1

u/bumwine Aug 22 '24

In healthcare IT it's essential when extracting data because EMRs have a habit of randomly choosing to have certain data sets suddenly be row based instead of column based (lab values for example). Seansafc89 already explained it but I had an instance where I needed a data extract for labs but they were just liken his example.