Showing posts with label partition over. Show all posts
Showing posts with label partition over. Show all posts

Friday, January 10, 2014

Find the most popular capitalization of a word or phrase

Today, I needed to find the most popular capitalization of user entered product brands. Previously, I'd just used lowercase brands, something like this:

However, this was returning "whole foods" instead of "Whole Foods", which was considered more desirable.

Using window functions and common table expressions, this is what I came up with: