Learning to use advanced SQL techniques can help you in two ways. It enables you to get to insights faster and, if you are using the output for further analysis, you can clean and format the data in the most efficient layout. What if your data already arrived in a nicely formatted list that you can use directly in python? Let’s review a few techniques across different databases, continuing to use the severe weather details data I have used in previous articles.

Rather than just cover the syntax of the code, though that is very important, I want to focus on business use cases. Learning how to figure out which technique helps you answer the business question is essential. To make it enjoyable, I like to focus on questions that just outside the range of typical. Ok, the Sharknado article was a bit out there.

The question

Florida, Have You Ever …had a weather event that caused loss of life?

Give me a list of all of the types of events where deaths occurred.

How do you answer this question with SQL?

The answer depends on your database. Each database may require a slightly different variation of SQL. It also depends on how you want your result formatted.

Things to consider:

How will the requestor use this list? If they are going to pass it to a python program, you want to provide a different format that if they’re going to cut and paste the list into a PowerPoint presentation.

Do you want that list sorted? Do you want the list deduped?

#data-analysis #women-in-tech #programming #data-science #sql

Using SQL to Play ‘Have You Ever?’
1.25 GEEK