|
Getting your Trinity Audio player ready...
|
In real companies, managers do not open databases and check raw tables. Instead, they rely on MIS reports to understand what is happening in the business.
MIS stands for Management Information System.
These reports help management answer questions like:
- Which department has the highest salary expense?
- How many employees are working in each region?
- Which product categories have the highest stock?
- Which products need to be reordered soon?
In this article, we will learn how SQL helps generate real MIS reports using data from an FMCG company database.
The tables we will use are:
employeesproducts
These are the same tables used in Smart SQL Playground, so you can run every query yourself.
Why SQL is Important for MIS Reporting
In many organizations, MIS teams receive requests such as:
- “Send department wise employee count.”
- “Give region wise salary report.”
- “Show products that are running out of stock.”
- “List top profitable products.”
Instead of manually filtering Excel files, SQL can generate these reports instantly.
SQL allows us to:
- Aggregate data
- Filter records
- Group information
- Build reusable reports
Letโs see some real examples.
Example 1: Department Wise Employee Count
Managers often want to know how many employees are working in each department.
SQL Query
SELECT
department,
COUNT(*) AS total_employees
FROM employees
GROUP BY department
ORDER BY total_employees DESC;What this query does
- Groups employees by department
- Counts employees in each department
- Sorts results from highest to lowest
Sample Report
| Department | Total Employees |
|---|---|
| Sales | 14 |
| Finance | 3 |
| IT | 3 |
| Marketing | 3 |
| Operations | 2 |
| HR | 2 |
| Executive | 1 |
This is a simple but powerful MIS report.
Example 2: Region Wise Employee Distribution
Large companies operate across different regions. Management may want to see employee distribution across regions.
SQL Query
SELECT
region,
COUNT(*) AS employee_count
FROM employees
GROUP BY region
ORDER BY employee_count DESC;What this shows
- Which region has the most employees
- Workforce distribution across the country
This helps HR and management plan recruitment and operations.
Example 3: Salary Expense by Department
Finance teams often want to know salary expenses by department.
SQL Query
SELECT
department,
SUM(salary) AS total_salary_expense
FROM employees
GROUP BY department
ORDER BY total_salary_expense DESC;Example Output
| Department | Total Salary |
|---|---|
| Executive | 500000 |
| Sales | 900000 |
| Finance | 585000 |
This report helps management control operational costs.
Example 4: Average Salary by Department
Managers may also want to compare average salary across departments.
SQL Query
SELECT
department,
ROUND(AVG(salary),2) AS avg_salary
FROM employees
GROUP BY department
ORDER BY avg_salary DESC;This helps HR analyze:
- Salary structure
- Department pay differences
Example 5: Employees Under Each Manager
The employees table contains a manager_id column.
We can create a report showing how many employees work under each manager.
SQL Query
SELECT
manager_id,
COUNT(*) AS team_size
FROM employees
WHERE manager_id IS NOT NULL
GROUP BY manager_id
ORDER BY team_size DESC;Why this report matters
It helps management understand:
- Organizational hierarchy
- Manager workload
- Team distribution
Example 6: Product Count by Category
FMCG companies sell thousands of products.
Management often wants to see product distribution by category.
SQL Query
SELECT
category,
COUNT(*) AS total_products
FROM products
GROUP BY category
ORDER BY total_products DESC;Example Result
| Category | Products |
|---|---|
| Beverages | 20 |
| Snacks | 20 |
| Dairy | 15 |
| Personal Care | 15 |
This helps understand the companyโs product portfolio.
Example 7: Current Stock by Category
Warehouse teams track stock levels across categories.
SQL Query
SELECT
category,
SUM(current_stock) AS total_stock
FROM products
GROUP BY category
ORDER BY total_stock DESC;Why this report matters
This helps management understand:
- Inventory distribution
- Stock-heavy categories
- Supply chain planning
Example 8: Products That Need Reordering
Products must be reordered when stock drops below a certain level.
In our dataset we have:
current_stockreorder_level
SQL Query
SELECT
product_code,
product_name,
current_stock,
reorder_level
FROM products
WHERE current_stock <= reorder_level
ORDER BY current_stock;Purpose
This report helps the inventory team identify low stock products.
Example 9: Most Profitable Products
Profit margin is stored in margin_percent.
SQL Query
SELECT
product_name,
category,
margin_percent
FROM products
ORDER BY margin_percent DESC
LIMIT 10;What this report shows
- Products with highest profit margin
- Best performing product categories
Example 10: GST Wise Product Distribution
In FMCG companies, different products have different GST rates.
SQL Query
SELECT
gst_rate,
COUNT(*) AS total_products
FROM products
GROUP BY gst_rate
ORDER BY gst_rate;This helps the finance team understand tax distribution across products.
Combining Multiple MIS Metrics
Sometimes management wants multiple insights in a single report.
Example: Category wise product metrics.
SQL Query
SELECT
category,
COUNT(*) AS total_products,
SUM(current_stock) AS total_stock,
ROUND(AVG(selling_price),2) AS avg_price
FROM products
GROUP BY category
ORDER BY total_products DESC;This gives a complete category performance report.
How MIS Reports Are Used in Real Companies
MIS SQL queries are used to generate reports for:
Daily Reports
- Employee attendance
- Sales updates
- Inventory status
Weekly Reports
- Department performance
- Stock movement
- Product sales trends
Monthly Reports
- Salary expenses
- Product performance
- Region wise growth
Many BI tools like:
- Power BI
- Tableau
- Metabase
actually run SQL queries in the background to generate dashboards.
Best Practices for Writing MIS Queries
Always use meaningful column names
Bad:
SELECT COUNT(*)Better:
SELECT COUNT(*) AS total_employeesAlways sort reports
Managers prefer sorted reports.
ORDER BY total_employees DESCLimit large reports
For example:
LIMIT 10Used for Top 10 products or Top 10 employees.
Use aggregations wisely
Common MIS functions:
COUNT()SUM()AVG()MIN()MAX()
Read More: Aggregate Functions in SQL
Summary
MIS reporting is one of the most practical uses of SQL in real companies.
Instead of manually preparing reports in Excel, SQL allows analysts to generate powerful reports directly from the database.
In this article, we created several useful MIS reports such as:
- Department wise employee count
- Region wise employee distribution
- Salary expense by department
- Product category reports
- Low stock product report
- High margin product analysis
All these reports were generated using just two tables:
employeesproducts
This shows how SQL can turn raw data into meaningful business insights.