SQL Programming Resources
76.2K subscribers
521 photos
13 files
467 links
Find top SQL resources from global universities, cool projects, and learning materials for data analytics.

Admin: @coderfun

Useful links: heylink.me/DataAnalytics

Promotions: @love_data
Download Telegram
If you have ever given an SQL interview some of the questions would be definitely from below list :

1- How to find duplicates in a table
2- How to delete duplicates from a table
3- Difference between union and union all
4- Difference between rank,row_number and dense_rank
5- Find records in a table which are not present in another table
6- Find second highest salary employees in each department
7- Find employees with salary more than their manager's salary
8- Difference between inner and left join
9- update a table and swap gender values.

If not exact at least flavor of these questions are always asked in interviews irrespective of your experience level
๐Ÿ‘8
Scenario based  Interview Questions & Answers for Data Analyst

1. Scenario: You are working on a SQL database that stores customer information. The database has a table called "Orders" that contains order details. Your task is to write a SQL query to retrieve the total number of orders placed by each customer.
  Question:
  - Write a SQL query to find the total number of orders placed by each customer.
Expected Answer:
    SELECT CustomerID, COUNT(*) AS TotalOrders
    FROM Orders
    GROUP BY CustomerID;

2. Scenario: You are working on a SQL database that stores employee information. The database has a table called "Employees" that contains employee details. Your task is to write a SQL query to retrieve the names of all employees who have been with the company for more than 5 years.
  Question:
  - Write a SQL query to find the names of employees who have been with the company for more than 5 years.
Expected Answer:
    SELECT Name
    FROM Employees
    WHERE DATEDIFF(year, HireDate, GETDATE()) > 5;

Power BI Scenario-Based Questions

1. Scenario: You have been given a dataset in Power BI that contains sales data for a company. Your task is to create a report that shows the total sales by product category and region.
    Expected Answer:
    - Load the dataset into Power BI.
    - Create relationships if necessary.
    - Use the "Fields" pane to select the necessary fields (Product Category, Region, Sales).
    - Drag these fields into the "Values" area of a new visualization (e.g., a table or bar chart).
    - Use the "Filters" pane to filter data as needed.
    - Format the visualization to enhance clarity and readability.

2. Scenario: You have been asked to create a Power BI dashboard that displays real-time stock prices for a set of companies. The stock prices are available through an API.
  Expected Answer:
    - Use Power BI Desktop to connect to the API.
    - Go to "Get Data" > "Web" and enter the API URL.
    - Configure the data refresh settings to ensure real-time updates (e.g., setting up a scheduled refresh or using DirectQuery if supported).
    - Create visualizations using the imported data.
    - Publish the report to the Power BI service and set up a data gateway if needed for continuous refresh.

3. Scenario: You have been given a Power BI report that contains multiple visualizations. The report is taking a long time to load and is impacting the performance of the application.
    Expected Answer:
    - Analyze the current performance using Performance Analyzer.
    - Optimize data model by reducing the number of columns and rows, and removing unnecessary calculations.
    - Use aggregated tables to pre-compute results.
    - Simplify DAX calculations.
    - Optimize visualizations by reducing the number of visuals per page and avoiding complex custom visuals.
    - Ensure proper indexing on the data source.

Free SQL Resources: https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v

Like if you need more similar content

Hope it helps :)
๐Ÿ‘10โค1
๐Ÿ”Ÿ Data Analyst Project Ideas for Beginners

1. Sales Analysis Dashboard: Use tools like Excel or Tableau to create a dashboard analyzing sales data. Visualize trends, top products, and seasonal patterns.

2. Customer Segmentation: Analyze customer data using clustering techniques (like K-means) to segment customers based on purchasing behavior and demographics.

3. Social Media Metrics Analysis: Gather data from social media platforms to analyze engagement metrics. Create visualizations to highlight trends and performance.

4. Survey Data Analysis: Conduct a survey and analyze the results using statistical techniques. Present findings with visualizations to showcase insights.

5. Exploratory Data Analysis (EDA): Choose a public dataset and perform EDA using Python (Pandas, Matplotlib) or R (tidyverse). Summarize key insights and visualizations.

6. Employee Performance Analysis: Analyze employee performance data to identify trends in productivity, turnover rates, and training effectiveness.

7. Public Health Data Analysis: Use datasets from public health sources (like CDC) to analyze trends in health metrics (e.g., vaccination rates, disease outbreaks) and visualize findings.

8. Real Estate Market Analysis: Analyze real estate listings to find trends in pricing, location, and features. Use data visualization to present your findings.

9. Weather Data Visualization: Collect weather data and analyze trends over time. Create visualizations to show changes in temperature, precipitation, or extreme weather events.

10. Financial Analysis: Analyze a companyโ€™s financial statements to assess its performance over time. Create visualizations to highlight key financial ratios and trends.

Data Analytics Resources ๐Ÿ‘‡๐Ÿ‘‡
https://whatsapp.com/channel/0029VaGgzAk72WTmQFERKh02

Hope it helps :)
๐Ÿ‘3โค1
SQL Round Interview Questions of Urban Company:-

Question 1: Monthly Revenue Trends by Category

Scenario: Analyze monthly revenue trends for each product category.
Table:
1. transactions (Transaction_id, Product_id, Amount_spent, Transaction_date),

2. products (Product_id, Category)

Challenge: Write a SQL query to calculate the total revenue for each category on a monthly basis and identify the top 3 categories with the highest revenue growth month-over-month.

Question 2: Customer Retention Analysis
Scenario: Determine the retention rate of customers.

Table:
1. customer_visits (Customer_id, Visit_date)

Challenge: Write a SQL query to calculate the retention rate of customers month-over-month for the past year, identifying the percentage of customers who return the following month.

Question 3: Product Affinity Analysis
Scenario: Identify products that are frequently bought together.

Table:
1. order_details (Order_id, Product_id, Quantity)

Challenge: Write a SQL query to find pairs of products that are frequently bought together. Include the count of how many times each pair appears in the same order and rank them by frequency.

Question 4: Customer Purchase Segmentation

Scenario: Segment customers based on their purchase behavior.
Table:
1. purchases (Customer_id, Product_id, Amount_spent, Purchase_date)

Challenge: Write a SQL query to segment customers into different groups based on their total spending and purchase frequency in the last year. Classify them into categories like 'High Spenders', 'Medium Spenders', and 'Low Spenders'.

Question 5: Anomaly Detection in Transactions

Scenario: Detect anomalies in transaction amounts.
Table:
1. transactions (Transaction_id, Customer_id, Amount_spent, Transaction_date)

Challenge: Write a SQL query to identify transactions that deviate significantly from the customer's average spending. Flag transactions that are more than three standard deviations away from the mean spending amount for each customer.


Data Analytics Resources
๐Ÿ‘‡๐Ÿ‘‡
https://whatsapp.com/channel/0029VaGgzAk72WTmQFERKh02

Hope it helps :)
๐Ÿ‘5โค2
๐Ÿ“ŠHere's a breakdown of SQL interview questions covering various topics:

๐Ÿ”บBasic SQL Concepts:
-Differentiate between SQL and NoSQL databases.
-List common data types in SQL.

๐Ÿ”บQuerying:
-Retrieve all records from a table named "Customers."
-Contrast SELECT and SELECT DISTINCT.
-Explain the purpose of the WHERE clause.


๐Ÿ”บJoins:
-Describe types of joins (INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN).
-Retrieve data from two tables using INNER JOIN.

๐Ÿ”บAggregate Functions:
-Define aggregate functions and name a few.
-Calculate average, sum, and count of a column in SQL.

๐Ÿ”บGrouping and Filtering:
-Explain the GROUP BY clause and its use.
-Filter SQL query results using the HAVING clause.

๐Ÿ”บSubqueries:
-Define a subquery and provide an example.

๐Ÿ”บIndexes and Optimization:
-Discuss the importance of indexes in a database.
&Optimize a slow-running SQL query.

๐Ÿ”บNormalization and Data Integrity:
-Define database normalization and its significance.
-Enforce data integrity in a SQL database.

๐Ÿ”บTransactions:
-Define a SQL transaction and its purpose.
-Explain ACID properties in database transactions.

๐Ÿ”บViews and Stored Procedures:
-Define a database view and its use.
-Distinguish a stored procedure from a regular SQL query.

๐Ÿ”บAdvanced SQL:
-Write a recursive SQL query and explain its use.
-Explain window functions in SQL.

โœ…๐Ÿ‘€These questions offer a comprehensive assessment of SQL knowledge, ranging from basics to advanced concepts.

โค๏ธLike if you'd like answers in the next post! ๐Ÿ‘

๐Ÿ‘‰Be the first one to know the latest Job openings ๐Ÿ‘‡
https://t.iss.one/jobs_SQL
โค4๐Ÿ‘4
Complete Roadmap to learn SQL in 2025 ๐Ÿ‘‡๐Ÿ‘‡

1. Basic Concepts
   - Understand databases and SQL.
   - Learn data types (INT, VARCHAR, DATE, etc.).

2. Basic Queries
   - SELECT: Retrieve data.
   - WHERE: Filter results.
   - ORDER BY: Sort results.
   - LIMIT: Restrict results.

3. Aggregate Functions
   - COUNT, SUM, AVG, MAX, MIN.
   - Use GROUP BY to group results.

4. Joins
   - INNER JOIN: Combine rows from two tables based on a condition.
   - LEFT JOIN: Include all rows from the left table.
   - RIGHT JOIN: Include all rows from the right table.
   - FULL OUTER JOIN: Include all rows from both tables.

5. Subqueries
   - Use nested queries for complex data retrieval.

6. Data Manipulation
   - INSERT: Add new records.
   - UPDATE: Modify existing records.
   - DELETE: Remove records.

7. Schema Management
   - CREATE TABLE: Define new tables.
   - ALTER TABLE: Modify existing tables.
   - DROP TABLE: Remove tables.

8. Indexes
   - Understand how to create and use indexes to optimize queries.

9. Views
   - Create and manage views for simplified data access.

10. Transactions
    - Learn about COMMIT and ROLLBACK for data integrity.

11. Advanced Topics
    - Stored Procedures: Automate complex tasks.
    - Triggers: Execute actions automatically based on events.
    - Normalization: Understand database design principles.

12. Practice
    - Use platforms like LeetCode, HackerRank, or learnsql for hands-on practice.

Here are some free resources to learn  & practice SQL ๐Ÿ‘‡๐Ÿ‘‡

Udacity free course- https://imp.i115008.net/AoAg7K

For Practice- https://stratascratch.com/?via=free

SQL Learning Series: https://t.iss.one/sqlspecialist/567

Free SQL Resources: https://whatsapp.com/channel/0029VaGgzAk72WTmQFERKh02

Join for more free resources: https://t.iss.one/free4unow_backup

ENJOY LEARNING ๐Ÿ‘๐Ÿ‘
โค4๐Ÿ‘3๐Ÿ‘1
4 popular SQL interview questions:

๐Ÿ”ปWhat is a primary key?
โ€” A primary key is a field in a table that uniquely identifies each row or record in that table.

๐Ÿ”ปWhat is a foreign key?
โ€” A foreign key is a field  in one table that refers to the primary key in another table, creating a relationship between the tables.

๐Ÿ”ปWhat are joins? Explain different types of joins.
โ€” A join is an SQL operation used to combine records from two or more tables. Common types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.

๐Ÿ”ปWhat is normalization?
โ€” Normalization is the process of organizing data to minimize redundancy and improve data integrity by dividing a database into multiple related tables.

Here you can find essential SQL Resources๐Ÿ‘‡
https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v

Like this post if you need more ๐Ÿ‘โค๏ธ

Hope it helps :)
๐Ÿ‘11โค4
SQL Interview Questions ๐Ÿ‘†
โค8๐Ÿ‘6
๐—ข๐—ฟ๐—ฑ๐—ฒ๐—ฟ ๐—ข๐—ณ ๐—˜๐˜…๐—ฒ๐—ฐ๐˜‚๐˜๐—ถ๐—ผ๐—ป โ†“

1 โ†’ FROM (Tables selected).
2 โ†’ WHERE (Filters applied).
3 โ†’ GROUP BY (Rows grouped).
4 โ†’ HAVING (Filter on grouped data).
5 โ†’ SELECT (Columns selected).
6 โ†’ ORDER BY (Sort the data).
7 โ†’ LIMIT (Restrict number of rows).

๐—–๐—ผ๐—บ๐—บ๐—ผ๐—ป ๐—ค๐˜‚๐—ฒ๐—ฟ๐—ถ๐—ฒ๐˜€ ๐—ง๐—ผ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ โ†“

โ†ฌ Find the second-highest salary:

SELECT MAX(Salary) FROM Employees WHERE Salary < (SELECT MAX(Salary) FROM Employees);

โ†ฌ Find duplicate records:

SELECT Name, COUNT(*)
FROM Emp
GROUP BY Name
HAVING COUNT(*) > 1;
โค8๐Ÿ‘5
9 tips to write clean SQL queries:

Use meaningful table & column aliases

Always indent your SQL clauses

Use UPPERCASE for SQL keywords

Avoid SELECT *

Use JOIN only when needed

Format long queries for readability

Use CTEs for complex logic

Add comments to tricky parts

Filter early with WHERE


Good SQL isn't just about getting the result โ€” It's about making sure others (and future you) can read it easily.

Clean queries save hours in debugging. Make them readable. Make them reusable.

#sql
โค8๐Ÿ‘4๐Ÿ‘1๐Ÿคฃ1
Most Asked SQL Interview Questions at MAANG Companies๐Ÿ”ฅ๐Ÿ”ฅ

Preparing for an SQL Interview at MAANG Companies? Here are some crucial SQL Questions you should be ready to tackle:

1. How do you retrieve all columns from a table?

SELECT * FROM table_name;

2. What SQL statement is used to filter records?

SELECT * FROM table_name
WHERE condition;

The WHERE clause is used to filter records based on a specified condition.

3. How can you join multiple tables? Describe different types of JOINs.

SELECT columns
FROM table1
JOIN table2 ON table1.column = table2.column
JOIN table3 ON table2.column = table3.column;

Types of JOINs:

1. INNER JOIN: Returns records with matching values in both tables

SELECT * FROM table1
INNER JOIN table2 ON table1.column = table2.column;

2. LEFT JOIN: Returns all records from the left table & matched records from the right table. Unmatched records will have NULL values.

SELECT * FROM table1
LEFT JOIN table2 ON table1.column = table2.column;

3. RIGHT JOIN: Returns all records from the right table & matched records from the left table. Unmatched records will have NULL values.

SELECT * FROM table1
RIGHT JOIN table2 ON table1.column = table2.column;

4. FULL JOIN: Returns records when there is a match in either left or right table. Unmatched records will have NULL values.

SELECT * FROM table1
FULL JOIN table2 ON table1.column = table2.column;

4. What is the difference between WHERE & HAVING clauses?

WHERE: Filters records before any groupings are made.

SELECT * FROM table_name
WHERE condition;

HAVING: Filters records after groupings are made.

SELECT column, COUNT(*)
FROM table_name
GROUP BY column
HAVING COUNT(*) > value;

5. How do you calculate average, sum, minimum & maximum values in a column?

Average: SELECT AVG(column_name) FROM table_name;

Sum: SELECT SUM(column_name) FROM table_name;

Minimum: SELECT MIN(column_name) FROM table_name;

Maximum: SELECT MAX(column_name) FROM table_name;

Here you can find essential SQL Interview Resources๐Ÿ‘‡
https://t.iss.one/mysqldata

Like this post if you need more ๐Ÿ‘โค๏ธ

Hope it helps :)
๐Ÿ‘10โค1
SQL Mindmap ๐Ÿ‘†
โค3
9 tips to learn SQL effectively:

Start with basic queries: SELECT, WHERE, ORDER BY

Understand different JOIN types clearly

Practice with real datasets (like IMDb, HR, Sales)

Learn GROUP BY and aggregate functions (SUM, AVG, COUNT)

Use subqueries and CTEs for complex logic

Explore window functions (ROW_NUMBER, RANK, etc.)

Understand NULLs and how to handle them

Practice writing clean, readable queries

Build mini projects or dashboards using SQL data

#sql
๐Ÿ‘6
Here are some essential SQL tips for beginners ๐Ÿ‘‡๐Ÿ‘‡

โ—† Primary Key = Unique Key + Not Null constraint
โ—† To perform case insensitive search use UPPER() function ex. UPPER(customer_name) LIKE โ€˜A%Aโ€™
โ—† LIKE operator is for string data type
โ—† COUNT(*), COUNT(1), COUNT(0) all are same
โ—† All aggregate functions ignore the NULL values
โ—† Aggregate functions MIN, MAX, SUM, AVG, COUNT are for int data type whereas STRING_AGG is for string data type
โ—† For row level filtration use WHERE and aggregate level filtration use HAVING
โ—† UNION ALL will include duplicates where as UNION excludes duplicates 
โ—† If the results will not have any duplicates, use UNION ALL instead of UNION
โ—† We have to alias the subquery if we are using the columns in the outer select query
โ—† Subqueries can be used as output with NOT IN condition.
โ—† CTEs look better than subqueries. Performance wise both are same.
โ—† When joining two tables , if one table has only one value then we can use 1=1 as a condition to join the tables. This will be considered as CROSS JOIN.
โ—† Window functions work at ROW level.
โ—† The difference between RANK() and DENSE_RANK() is that RANK() skips the rank if the values are the same.
โ—† EXISTS works on true/false conditions. If the query returns at least one value, the condition is TRUE. All the records corresponding to the conditions are returned.

Here you can find essential SQL Resources๐Ÿ‘‡
https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v

Like this post if you need more ๐Ÿ‘โค๏ธ

Hope it helps :)
โค3๐Ÿ‘3
Relatable? ๐Ÿ˜‚
๐Ÿคฃ16
๐—ง๐—ต๐—ฒ ๐—ฏ๐—ฒ๐˜€๐˜ ๐—ฆ๐—ค๐—Ÿ ๐—น๐—ฒ๐˜€๐˜€๐—ผ๐—ป ๐˜†๐—ผ๐˜‚โ€™๐—น๐—น ๐—ฟ๐—ฒ๐—ฐ๐—ฒ๐—ถ๐˜ƒ๐—ฒ ๐˜๐—ผ๐—ฑ๐—ฎ๐˜†:

Master the core SQL statementsโ€”they are the building blocks of every powerful query you'll write.

-> SELECT retrieves data efficiently and accurately. Remember, clarity starts with understanding the result set you need.

-> WHERE filters data to show only the insights that matter. Precision is key.

-> CREATE, INSERT, UPDATE, DELETE allow you to mold your database like an artistโ€”design it, fill it, improve it, or even clean it up.

In a world where everyone wants to take, give knowledge back.

Become an alchemist of your life. Learn, share, and build solutions.

Always follow best practices in SQL to avoid mistakes like missing WHERE in an UPDATE or DELETE. These oversights can cause chaos!

Without WHERE, you risk updating or deleting entire datasets unintentionally. That's a costly mistake.

But with proper syntax and habits, your databases will be secure, efficient, and insightful.

SQL is not just a skillโ€”it's a mindset of precision, logic, and innovation.

Here you can find essential SQL Interview Resources๐Ÿ‘‡
https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v

Like this post if you need more ๐Ÿ‘โค๏ธ

Hope it helps :)

#sql
โค2๐Ÿ‘2
9 tips to learn SQL for Data Analysis:

๐Ÿงฑ Start with basic queries: SELECT, WHERE, ORDER BY
๐Ÿ”— Understand different types of JOINs
๐Ÿ“Š Use GROUP BY with aggregate functions like SUM, AVG, COUNT
๐Ÿงฎ Practice filtering using HAVING and complex WHERE conditions
๐Ÿง  Learn CASE WHEN for conditional logic
๐Ÿงพ Explore subqueries and Common Table Expressions (CTEs)
๐Ÿช„ Use WINDOW functions like ROW_NUMBER, RANK, LEAD, LAG
๐Ÿ” Understand how to handle NULL values properly
๐Ÿ“ Work on real-world datasets to sharpen your skills

Here you can find essential SQL Interview Resources๐Ÿ‘‡
https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v

Like this post if you need more ๐Ÿ‘โค๏ธ

Hope it helps :)

#sql
๐Ÿ‘4โค1
SQL Basics Cheatsheet ๐Ÿ‘†
๐Ÿ‘5โค1