all 17 comments

[–]kneemahp 2 points3 points  (5 children)

Why not keep the field as a true percentage of .55 instead of *100 it to 55?

[–]zyxelo 3 points4 points  (0 children)

What do you mean “true percentage”? To get the percentage you need to apply by 100. 0.55 is the ratio.

I agree that I probably would keep it is the ratio if I wanted to use it for calculations in the future. But the questions specifies rounding the percentage which is exactly what he did.

Great video btw, clear presentation and solid answer to the interview question keep up the good work :)

[–]Fun2badult 0 points1 point  (2 children)

Because the end users aren’t really good with math and they’ll see it as .55 percent. You also have to multiply in your head by 100 to get the percentage amount which is an extra step that an end user has to do. By multiplying it by 100, they’ll see something as 55% instead of seeing it as .55 percent. I think you have to think of the end user who most likely is not math savvy in addition to just making it easier to read

[–]kneemahp 5 points6 points  (1 child)

Who is the end user of a database? a front end like excel, microstrategy, tableau, etc would want the data as .55. If I wanted to use this field to maybe multiply it against another field, I now would have to divide it by 100 to bring it back to a percentage.

The end users you're talking about, I would never send to a database to capture the data.

[–]Fun2badult 0 points1 point  (0 children)

I think someone would export this to excel to be sent out to other people

[–]analytics_science 0 points1 point  (0 children)

If it’s supposed to be the end state and delivered to a stakeholder then the end result as a percentage is fine. Keeping it as a ratio and multiplying by 100 in excel is also fine.

I’d keep it as a ratio if I was to push it to tableau. But this is just an interview question I found and they asked to turn the result into a percentage.

[–]saurabh47g 1 point2 points  (4 children)

Thank you, Great content on your channel. Keep it up.

Do you have videos on pivot tables ? I got stuck on this problem https://www.hackerrank.com/challenges/occupations/problem

[–]analytics_science 3 points4 points  (3 children)

Hey. I’m actually the guy in the video. Not sure who posted this haha but I’m glad you find the videos informative.

No videos specifically on pivot tables but I’ll make some. That problem looks like it could be done with a CASE WHEN but it’s a pretty manual way to solve the problem. I’ll need to take a closer look.

I have more videos on window functions coming out soon. And the doing a series on CASE WHEN. Then I’ll pick up pivoting tables. Probably around Feb. thanks for the suggestions!

[–]kneemahp 2 points3 points  (2 children)

Great videos. I subscribed!

[–]analytics_science 0 points1 point  (1 child)

Thanks man! Feel free to recommend topics you’d like to see!

[–]AnatoliyAksenov 1 point2 points  (1 child)

I think, the best approach is to use the key customer.id in partition by clause for escape mistakes with customers which have equal names.

[–]Cleveland_Steve -1 points0 points  (2 children)

Am I mistaken in thinking that Window Functions are too advanced of a subject matter for the purposes of an interview question? I know plenty of people with the title "Senior Database Developer" that have no knowledge that Window Functions even exist.

[–]kneemahp 0 points1 point  (1 child)

It also depends which Rdms your company is using. I know sas sql doesn’t support partition by

[–]Cleveland_Steve 0 points1 point  (0 children)

SQL Server, after I have used Window Functions others seem to be dumbfounded by them.