Stripe interview question

Explain window functions. What is the difference between ROW_NUMBER(), RANK(), and DENSE_RANK()? How would you find the running total of sales by date? What causes poor SQL query performance, and how would you optimize a slow query? What is the difference between OLTP and OLAP systems? How would you handle slowly changing dimensions (SCD) in a data warehouse?