Member-only story
Thought Process Behind SQL Query: 4 Simple Steps
How To Craft Your SQL Query Systematically
If you are not a member, read the full article here.
Writing SQL queries might feel like crossing a maze, especially during a data science interview.
Many candidates fail to understand the data structure, define the intended output, and identify the required SQL phrases. This might cause dissatisfaction and a lack of confidence.
The article below attempts to simplify the process by breaking it down into four easy steps.
Following this structured technique will allow you to create SQL queries systematically and efficiently, minimizing worry and increasing confidence.
Problem Statement
Write a SQL query to find the user IDs of all users who have created at least one ‘Refinance’ submission and at least one ‘InSchool’ submission.
Step-by-Step Thought Process
1. Understand the Tables and Data Structure
Before you write any SQL query, be sure you understand the tables and their relationships.
In this scenario, we will suppose that there is a table called loans
with the following important…