SQL Programming Resources
75.9K subscribers
530 photos
13 files
468 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
1. What is the difference between the RANK() and DENSE_RANK() functions?

The RANK() function in the result set defines the rank of each row within your ordered partition. If both rows have the same rank, the next number in the ranking will be the previous rank plus a number of duplicates. If we have three records at rank 4, for example, the next level indicated is 7. The DENSE_RANK() function assigns a distinct rank to each row within a partition based on the provided column value, with no gaps. If we have three records at rank 4, for example, the next level indicated is 5.

2. Explain One-hot encoding and Label Encoding. How do they affect the dimensionality of the given dataset?

One-hot encoding is the representation of categorical variables as binary vectors. Label Encoding is converting labels/words into numeric form. Using one-hot encoding increases the dimensionality of the data set. Label encoding doesn’t affect the dimensionality of the data set. One-hot encoding creates a new variable for each level in the variable whereas, in Label encoding, the levels of a variable get encoded as 1 and 0.

3. Explain the Difference Between Tableau Worksheet, Dashboard, Story, and Workbook in Tableau?

Tableau uses a workbook and sheet file structure, much like Microsoft Excel.
A workbook contains sheets, which can be a worksheet, dashboard, or a story.
A worksheet contains a single view along with shelves, legends, and the Data pane.
A dashboard is a collection of views from multiple worksheets.
A story contains a sequence of worksheets or dashboards that work together to convey information.

4. How can you split a column into 2 or more columns?

You can split a column into 2 or more columns by following the below steps:
1. Select the cell that you want to split. Then, navigate to the Data tab, after that, select Text to Columns. 2. Select the delimiter. 3. Choose the column data format and select the destination you want to display the split. 4. The final output will look like below where the text is split into multiple columns.

5. Do you wanna make your career in Data Science & Analytics but don't know how to start ?

https://t.iss.one/sqlspecialist/851

Here are free resources that will make you technically strong enough to crack any Data Analyst and also learn Pro Career Growth Hacks to land on your Dream Job.
πŸ‘4πŸ‘2❀1
Interviewer: You mentioned that you had reduced cloud storage costs by 50%.

Candidate: Yeah!

Interviewer: How?

Candidate: 𝐃𝐄𝐋𝐄𝐓𝐄 * 𝐟𝐫𝐨𝐦 π‚π”π’π“πŽπŒπ„π‘π’ 𝐰𝐑𝐞𝐫𝐞 𝐒𝐝%𝟐==𝟎
🀣9πŸ‘3
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.

Like for more πŸ˜„πŸ˜„
❀2πŸ‘2
Key SQL Concepts for Data Analyst Interviews

1. Joins: Understand how to use INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN to combine data from different tables, ensuring you can retrieve the needed information from relational databases.

2. Group By and Aggregate Functions: Master GROUP BY along with aggregate functions like COUNT(), SUM(), AVG(), MAX(), and MIN() to summarize data and generate meaningful reports.

3. Data Filtering: Use WHERE, HAVING, and CASE statements to filter and manipulate data effectively, enabling precise data extraction based on specific conditions.

4. Subqueries: Employ subqueries to retrieve data nested within other queries, allowing for more complex data retrieval and analysis scenarios.

5. Window Functions: Leverage window functions such as ROW_NUMBER(), RANK(), DENSE_RANK(), and LAG() to perform calculations across a set of table rows, returning result sets with contextual calculations.

6. Data Types: Ensure proficiency in choosing and handling various SQL data types (VARCHAR, INT, DATE, etc.) to store and query data accurately.

7. Indexes: Learn how to create and manage indexes to speed up the retrieval of data from databases, particularly in tables with large volumes of records.

8. Normalization: Apply normalization principles to organize database tables efficiently, reducing redundancy and improving data integrity.

9. CTEs and Views: Utilize Common Table Expressions (CTEs) and Views to write modular, reusable, and readable queries, making complex data analysis tasks more manageable.

10. Data Import/Export: Know how to import and export data between SQL databases and other tools like BI tools to facilitate comprehensive data analysis workflows.

Here you can find SQL Interview ResourcesπŸ‘‡
https://t.iss.one/DataSimplifier

Share with credits: https://t.iss.one/sqlspecialist

Hope it helps :)
πŸ‘3πŸŽ‰1
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
πŸ‘4πŸŽ‰2
Do not wait till you've mastered SQL till you apply to your first Data Analyst Job.

You can do both at the same time.
❀2
10 SQL Concepts Every Data Analyst Should Master πŸ‘‡

βœ… SELECT, WHERE, ORDER BY – Core of querying your data
βœ… JOINs (INNER, LEFT, RIGHT, FULL) – Combine data from multiple tables
βœ… GROUP BY & HAVING – Aggregate and filter grouped data
βœ… Subqueries – Nest queries inside queries for complex logic
βœ… CTEs (Common Table Expressions) – Write cleaner, reusable SQL logic
βœ… Window Functions – Perform advanced analytics like rankings & running totals
βœ… Indexes – Boost your query performance
βœ… Normalization – Structure your database efficiently
βœ… UNION vs UNION ALL – Combine result sets with or without duplicates
βœ… Stored Procedures & Functions – Reusable logic inside your DB

React with ❀️ if you want me to cover each topic in detail

Share with credits: https://t.iss.one/sqlspecialist

Hope it helps :)
πŸ‘4πŸ‘1
Hey guys,

Today, let’s talk about SQL conceptual questions that are often asked in data analyst interviews. These questions test not only your technical skills but also your conceptual understanding of SQL and its real-world applications.

1. What is the difference between SQL and NoSQL?

- SQL (Structured Query Language) is a relational database management system, meaning it uses tables (rows and columns) to store data.
- NoSQL databases, on the other hand, handle unstructured data and don’t rely on a schema, making them more flexible in terms of data storage and retrieval.
- Interview Tip: Don't just memorize definitions. Be prepared to explain scenarios where you’d use SQL over NoSQL, and vice versa.

2. What is the difference between INNER JOIN and OUTER JOIN?

- An INNER JOIN returns records that have matching values in both tables.
- An OUTER JOIN returns all records from one table and the matched records from the second table. If there's no match, NULL values are returned.

3. How do you optimize a SQL query for better performance?

- Indexing: Create indexes on columns used frequently in WHERE, JOIN, or GROUP BY clauses.
- Query optimization: Use appropriate WHERE clauses to reduce the data set and avoid unnecessary calculations.
- Avoid SELECT *: Always specify the columns you need to reduce the amount of data retrieved.
- Limit results: If you only need a subset of the data, use the LIMIT clause.

4. What are the different types of SQL constraints?

Constraints are used to enforce rules on data in a table. They ensure the accuracy and reliability of the data. The most common types are:

- PRIMARY KEY: Ensures each record is unique and not null.
- FOREIGN KEY: Enforces a relationship between two tables.
- UNIQUE: Ensures all values in a column are unique.
- NOT NULL: Prevents NULL values from being entered into a column.
- CHECK: Ensures a column's values meet a specific condition.

5. What is normalization? What are the different normal forms?

Normalization is the process of organizing data to reduce redundancy and improve data integrity. Here’s a quick overview of normal forms:

- 1NF (First Normal Form): Ensures that all values in a table are atomic (indivisible).
- 2NF (Second Normal Form): Ensures that the table is in 1NF and that all non-key columns are fully dependent on the primary key.
- 3NF (Third Normal Form): Ensures that the table is in 2NF and all columns are independent of each other except for the primary key.

6. What is a subquery?

A subquery is a query within another query. It's used to perform operations that need intermediate results before generating the final query.

Example:
SELECT employee_id, name
FROM employees
WHERE salary > (SELECT AVG(salary) FROM employees);

In this case, the subquery calculates the average salary, and the outer query selects employees whose salary is greater than the average.

7. What is the difference between a UNION and a UNION ALL?

- UNION combines the result sets of two SELECT statements and removes duplicates.
- UNION ALL combines the result sets and includes duplicates.

8. What is the difference between WHERE and HAVING clause?

- WHERE filters rows before any groupings are made. It’s used with SELECT, INSERT, UPDATE, or DELETE statements.
- HAVING filters groups after the GROUP BY clause.

9. How would you handle NULL values in SQL?

NULL values can represent missing or unknown data. Here’s how to manage them:

- Use IS NULL or IS NOT NULL in WHERE clauses to filter null values.
- Use COALESCE() or IFNULL() to replace NULL values with default ones.

Example:
SELECT name, COALESCE(age, 0) AS age
FROM employees;


10. What is the purpose of the GROUP BY clause?

The GROUP BY clause groups rows with the same values into summary rows. It’s often used with aggregate functions like COUNT, SUM, AVG, etc.

Example:
SELECT department, COUNT(*)
FROM employees
GROUP BY department;


Here you can find SQL Interview ResourcesπŸ‘‡
https://t.iss.one/DataSimplifier

Share with credits: https://t.iss.one/sqlspecialist

Hope it helps :)
πŸ‘9❀1πŸŽ‰1
Majority of top companies hiring for analytic roles (Data Analyst/Business Analyst) focus heavily on SQL understanding as a selection criteria, which according to me, should be the first thing you start your preparation with.

I have divided this SQL roadmap into 3 steps (Basics, Level Up & Practice), and it should take around 1 month to complete.

Step 1 - Basics πŸ”’ :

➑What is a Relational Database / RDBMS?
➑SQL Data Types - Varchar, text, int, number, date, float, boolean.
➑SQL commands - select, where, like, distinct, between, group by, having, order by, insert into, case when, update, truncate, delete, commit, rollback (basically all the DDL, DML, DCL, TCL commands in SQL).
➑Integrity Constraints - Primary key, foreign key, not null, unique.
➑Operators arithmetic, logical, and comparison operations.
➑Use of distinct, order by, limit, and top.
➑Use of union and union all.
➑Joins in SQL inner, left, right, outer, self, full outer, cross join.


Step 2 - Level up ⬆⬆ :

➑Normalization in SQL
➑Aggregate, date, and string functions
➑Sub-Queries
➑CTE table / with clause
➑In-built SQL functions
➑Window functions
➑Views


Step 3 - Practice SQL Questions on leetcode & hackerrank βœ…

Hope it helps :)
πŸ‘6
Quick recap of essential SQL basics πŸ˜„πŸ‘‡

SQL is a domain-specific language used for managing and querying relational databases. It's crucial for interacting with databases, retrieving, storing, updating, and deleting data. Here are some fundamental SQL concepts:

1. Database
   - A database is a structured collection of data. It's organized into tables, and SQL is used to manage these tables.

2. Table
   - Tables are the core of a database. They consist of rows and columns, and each row represents a record, while each column represents a data attribute.

3. Query
   - A query is a request for data from a database. SQL queries are used to retrieve information from tables. The SELECT statement is commonly used for this purpose.

4. Data Types
   - SQL supports various data types (e.g., INTEGER, TEXT, DATE) to specify the kind of data that can be stored in a column.

5. Primary Key
   - A primary key is a unique identifier for each row in a table. It ensures that each row is distinct and can be used to establish relationships between tables.

6. Foreign Key
   - A foreign key is a column in one table that links to the primary key in another table. It creates relationships between tables in a database.

7. CRUD Operations
   - SQL provides four primary operations for data manipulation:
     - Create (INSERT) - Add new records to a table.
     - Read (SELECT) - Retrieve data from one or more tables.
     - Update (UPDATE) - Modify existing data.
     - Delete (DELETE) - Remove records from a table.

8. WHERE Clause
   - The WHERE clause is used in SELECT, UPDATE, and DELETE statements to filter and conditionally manipulate data.

9. JOIN
   - JOIN operations are used to combine data from two or more tables based on a related column. Common types include INNER JOIN, LEFT JOIN, and RIGHT JOIN.

10. Index
   - An index is a database structure that improves the speed of data retrieval operations. It's created on one or more columns in a table.

11. Aggregate Functions
   - SQL provides functions like SUM, AVG, COUNT, MAX, and MIN for performing calculations on groups of data.

12. Transactions
   - Transactions are sequences of one or more SQL statements treated as a single unit. They ensure data consistency by either applying all changes or none.

13. Normalization
   - Normalization is the process of organizing data in a database to minimize data redundancy and improve data integrity.

14. Constraints
   - Constraints (e.g., NOT NULL, UNIQUE, CHECK) are rules that define what data is allowed in a table, ensuring data quality and consistency.

Here is an amazing resources to learn & practice SQL: https://bit.ly/3FxxKPz

Share with credits: https://t.iss.one/sqlspecialist

Hope it helps :)
❀6πŸ‘2πŸŽ‰1
πŸ”… MySQL Cheat SheetπŸ’‘
❀4πŸ‘2
Building vs Learning:

Why You Should Build First
(Because you don’t become a developer by just learning β€” you become one by DOING.)

Most beginners make this mistake:

They spend months learning...

Watching 10-hour tutorials

Reading endless docs

Taking detailed notes

Going through β€œBeginner to Advanced” courses
…without ever building a single project.

Then one day they try to build something from scratch and realize:

β€œWait. I don’t know where to start.”
β€œWhy is everything breaking?”
β€œThis looked easy in the tutorial…”

That’s not your brain failing. That’s your learning method failing.

Here’s the brutal truth:
🧠 You don’t retain skills by watching.
πŸ’ͺ🏽 You retain them by struggling, building, breaking, and fixing.

You could study code for a year and still get stuck building a to-do app β€” because real understanding comes from doing, not absorbing.

Why You Should Build First:
βœ… You expose gaps instantly.
When you try to build something, your weak spots show themselves β€” fast. And that’s a good thing.

βœ… You gain momentum.
Even small wins (like making a button work or connecting to an API) build massive confidence.

βœ… You stop depending on tutorials.
The second you build something original, you shift from student to developer.

βœ… You start thinking like a problem solver.
Building forces you to ask:

β€œWhat do I want this to do?”
β€œHow do I get there?”
β€œWhy isn’t this working?”
That’s the mindset that companies pay for.

Here’s the smarter path:
Learn a concept just enough to understand it

Immediately apply it in your own project

Get stuck, fix it, and grow

Repeat until you can explain it without Googling it

πŸ“Œ Bottom line?

Learning is passive. Building is transformational.
If you want to stop feeling like a beginner and actually become a real dev β€” start building.

Even if it’s messy.
Even if it’s small.
Even if it’s ugly.

And that’s exactly what you’ll get inside The Programmer’s University.

This is not just a roadmap.
It’s a full-scale training program that takes you from beginner to job-ready by making you:

πŸ’» Build 10+ fullstack projects
🎯 Execute your dream capstone project
πŸ“¦ Learn frontend, backend, APIs, databases, and deployment
🧰 Get mentorship, accountability, and feedback
πŸš€ Walk out with a job-ready GitHub, a killer portfolio, and the confidence to win interviews

This isn’t about learning more.
It’s about learning what actually matters β€” and building your way to the finish line.
πŸ‘6❀2
7 SQL concepts you still ignore but appear in almost every interview:

1. WINDOW FUNCTIONS
You love GROUP BY but forget ROW_NUMBER() and RANK() exist. Fix that.


2. SELF JOINS
Real analysts join tables with themselves. Do you?


3. CTEs (WITH clause)
Stop writing 5-level nested subqueries. Use Common Table Expressions like a pro.


4. NULL Handling
NULL IS NOT 0. NULL != ''. Know how COALESCE() and ISNULL() work.


5. EXISTS vs IN vs JOIN
Not all filters are created equal. Know their performance differences.


6. AGGREGATIONS WITH CASE
Counting conditionally? SUM(CASE WHEN...) is your friend.


7. DATE FUNCTIONS
If you can’t calculate month-over-month growth in SQL, you’re not ready.

If you've new to SQL, Check this Learning Series: https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v/1075
❀6πŸ‘1πŸ€”1πŸŽ‰1
Questions & Answers for Data Analyst Interview

Question 1: Describe a time when you used data analysis to solve a business problem.
Ideal answer: This is your opportunity to showcase your data analysis skills in a real-world context. Be specific and provide examples of your work. For example, you could talk about a time when you used data analysis to identify customer churn, improve marketing campaigns, or optimize product development.

Question 2: What are some of the challenges you have faced in previous data analysis projects, and how did you overcome them?
Ideal answer: This question is designed to assess your problem-solving skills and your ability to learn from your experiences. Be honest and upfront about the challenges you have faced, but also focus on how you overcame them. For example, you could talk about a time when you had to deal with a large and messy dataset, or a time when you had to work with a tight deadline.

Question 3: How do you handle missing values in a dataset?
Ideal answer: Missing values are a common problem in data analysis, so it is important to know how to handle them properly. There are a variety of different methods that you can use, depending on the specific situation. For example, you could delete the rows with missing values, impute the missing values using a statistical method, or assign a default value to the missing values.

Question 4: How do you identify and remove outliers?
Ideal answer: Outliers are data points that are significantly different from the rest of the data. They can be caused by data errors or by natural variation in the data. It is important to identify and remove outliers before performing data analysis, as they can skew the results. There are a variety of different methods that you can use to identify outliers, such as the interquartile range (IQR) method or the standard deviation method.

Question 5: How do you interpret and communicate the results of your data analysis to non-technical audiences?
Ideal answer: It is important to be able to communicate your data analysis findings to both technical and non-technical audiences. When communicating to non-technical audiences, it is important to avoid using jargon and to focus on the key takeaways from your analysis. You can use data visualization tools to help you communicate your findings in a clear and concise way.
In addition to providing specific examples and answers to the questions, it is also important to be enthusiastic and demonstrate your passion for data analysis. Show the interviewer that you are excited about the opportunity to use your skills to solve real-world problems.
❀4πŸ‘2πŸ‘1