Calculations
SQL Calculation Interview Questions
Calculations are the rates, shares and percentages most analytics answers come down to: conversion rate, revenue per order, share of total. The arithmetic is simple. Deciding what belongs on the bottom of the fraction is the hard part.
What calculation questions ask you to do
Across the questions here, these are the shapes that come up:
- Work out a conversion or completion rate
- Express one group as a share of the total
- Compare two periods as a percentage change
- Produce a per-unit figure such as revenue per order
- Average something where a plain average would be misleading
Common mistakes with calculations
Two things go wrong, and both are on the bottom of the fraction. Dividing by a count that can reach zero either errors or returns nothing at all. And dividing one whole number by another throws away the decimals in several databases, so a conversion rate comes back as 0 instead of 0.37.