Introduction

This post picks up from Part 1, where I analysed general name trends and identified a few girl names to help out a friend. In this post, I used subqueries and common table expressions (CTE) to further explore baby name trends in the USA.

6. Subquery: Most picked boy names over the years

I started off with a query that returns boy names with the highest count/frequency every year. I then joined this query into a main query to find out the most picked name overall.

Query:

Result:

 

7. CTE: Which boy name is the all-time favourite?

Now we have the yearly most popular male names. We can clearly see that some names won the most popular seat for more than one year. But which name has accomplished this the most? To do this, I used the query from the task above as a CTE names max_male. From there, I count the names that have appeared the most times.

Query:

Result:

Conclusion

While it may not have been as popular as Liam, Noah, and Jacob in recent years, the name Michael has a longer history of being the most picked out boy name over the century.
The Data School
Author: The Data School