What is SQL?
- Kirtish Badwe
- 5 days ago
- 3 min read
Have you looked at the job postings of any Analytics roles? I'm sure you have.
One thing you would've observed that, irrespective of the company size or seniority of the role, almost every job mentions SQL Proficiency as one of the core skills required.
But what exactly is SQL? And why is it so important?
Wikipedia defines SQL as
Structured Query Language (SQL) is a domain-specific language used to manage data, especially in a relational database management system (RDBMS)
In layman's language, SQL is a tool which allows us to manipulate data stored in tables. Let's understand this a bit deeper.
Broadly, data can be divided into 2 categories: Structured and Unstructured
Unstructured Data includes Images, Audio, Video etc.
Structured Data includes data stored in JSON, Comma Separated Values, Tables etc.
A subset of structured data is relational data i.e. data stored in multiple tables, which are connected by a specific column.
The following diagram shows a simplified example of what relational database is.

When data is present in such a tabular format, SQL allows us to explore the data and derive insights.
Let us try to understand SQL syntax with an example. Consider the tabular structure mentioned above.
table_1: Contains the Daily Revenue from every Customer for every Category,
table_2: Contains the customer and city mapping
table_3: Contains the category name mapping
Now, we want to get the following data
What is the City-wise Total Revenue from Electronics category for 1-Nov-2025
If asked to do manually, how would we do it?
Get the revenue of each customer
Map the city of each customer
Map the category name for every category_id
Filter out the rows for Electronics category
Filter out the rows for 1-Nov-2025
Add up the revenue for every city separately.
Show the final city-wise revenue
Looks simple, right?
Technically, yes. But what if we have millions of rows in the table?
SQL to the rescue!
SQL allows us to exactly do the steps mentioned above, AT SCALE!
Following is a SQL snippet which gets the job done.
select
city,
sum(amount) as city_wise_revenue
from table_1
join table_2 on table_1.customer_id = table_2.customer_id
join table_3 on table_1.category_id = table_3.category_id
where table_3.name = 'Electronics'
and table_1.date = '1-Nov-2025'
group by cityResults (sample values)
city | city_wise_revenue |
Mumbai | 5000 |
Bengaluru | 4000 |
Delhi | 3500 |
Let us breakdown the SQL query line-by-line. Following
from
It references the primary table which we want to read.
from table_1join
It references additional tables that we need to create a proper mapping. table_2 and table_3 in our example to get the city and category name mapping
join table_2 on table_1.customer_id = table_2.customer_id
join table_3 on table_1.category_id = table_3.category_idFollowing is the interpretation of the join syntax
join table_3 on table_1 using customer_id column from table_1 and customer_id column from table_2
join table_3 on table_2 using category_id column from table_1 and category_id column from table_2
Once all the tables are read and joined, a merged table is created in the query as follows. All the operations further are done on this table

where
This statement is used to filter out the relevant rows from the merged table
where table_3.name = 'Electronics'
and table_1.date = '1-Nov-2025'Filter out the rows with Electronics category name only
Filter out the rows only for 1-Nov-2025
select
Once all the rows are filtered out, now we select only the columns that we need. The columns we include in select statement are present in our final output
select
city,
sum(amount) as city_wise_revenueHere, we have selected city and city_wise_revenue as the columns that we need in the final output.
city_wise_revenue is calculated as sum(amount). It simply sums up the amount column from the filtered table.
group by
Probably one of the most important statement.
group by cityThis directs the query to do sum(amount) separately for every city and then display the amount.
And that's it!
These basic statements allow us to read any data and get insights - be it stored in a single table of multiple tables.
In my opinion, SQL is a must have to any Analytics professional. But, not only Analysts, even Product Managers can benefit immensely, as it allows them to quick fetch data, understand metrics and create estimates.
Irrespective of what anyone says, in today's data-driven world, knowing SQL is like a Superpower!

Comments