TGViewer
Channel Public Channel
SQL Programming Resources

SQL Programming Resources

@sqlanalyst

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
Subscribers
76.7K
Photos
598
Videos
1
Links
568

Showing posts older than #1944 ยท Back to latest

Older Posts 16 shown
Post #1942 1.84K
Most people learn SQL just enough to pull some data. But if you really understand it, you can analyze massive datasets without touching Excel or Python.

Here are 8 game-changing SQL concepts that will make you a data pro:

๐Ÿ‘‡


1. Stop pulling raw data. Start pulling insights.

The biggest mistake? Running a query that gives you everything and then filtering it later.

Good analysts donโ€™t pull raw data. They shape the data before it even reaches them.

2. โ€œSELECT โ€ is a rookie move.

Pulling all columns is lazy and slow.

A pro only selects what they need.
โœ”๏ธ Fewer columns = Faster queries
โœ”๏ธ Less noise = Clearer insights

The more precise your query, the less time you waste cleaning data.

3. GROUP BY is your best friend.

You donโ€™t need 100,000 rows of transactions. What you need is:
โœ”๏ธ Sales per region
โœ”๏ธ Average order size per customer
โœ”๏ธ Number of signups per month

Grouping turns chaotic data into useful summaries.

4. Joins = Connecting the dots.

Your most important data is split across multiple tables.

Want to know how much each customer spent? You need to join:
โœ”๏ธ Customer info
โœ”๏ธ Order history
โœ”๏ธ Payments

Joins = unlocking hidden insights.

5. Window functions will blow your mind.

They let you:
โœ”๏ธ Rank customers by total purchases
โœ”๏ธ Calculate rolling averages
โœ”๏ธ Compare each row to the overall trend

Itโ€™s like pivot tables, but way more powerful.

6. CTEs will save you from spaghetti SQL.

Instead of writing a 50-line nested query, break it into steps.

CTEs (Common Table Expressions) make your SQL:
โœ”๏ธ Easier to read
โœ”๏ธ Easier to debug
โœ”๏ธ Reusable

Good SQL is clean SQL.

7. Indexes = Speed.

If your queries take forever, your database is probably doing unnecessary work.

Indexes help databases find data faster.

If you work with large datasets, this is a game changer.

SQL isnโ€™t just about pulling data. Itโ€™s about analyzing, transforming, and optimizing it.

Master these 7 concepts, and youโ€™ll never look at SQL the same way again.

Join us on WhatsApp: https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v
  • โค 3
  • ๐Ÿ‘ 1
Post #1940 1.78K
Below ๐ˆโ€™๐ฆ ๐ฌ๐ก๐š๐ซ๐ข๐ง๐  ๐Ÿ“ ๐’๐๐‹ ๐ˆ๐ง๐ญ๐ž๐ซ๐ฏ๐ข๐ž๐ฐ ๐๐ฎ๐ž๐ฌ๐ญ๐ข๐จ๐ง๐ฌ asked in a recent interview for a ๐ƒ๐š๐ญ๐š ๐€๐ง๐š๐ฅ๐ฒ๐ฌ๐ญ ๐ซ๐จ๐ฅ๐ž ๐š๐ญ ๐†๐ž๐ง๐ฉ๐š๐œ๐ญ (๐Ÿโ€“๐Ÿ“ ๐ฒ๐ž๐š๐ซ๐ฌ ๐ž๐ฑ๐ฉ๐ž๐ซ๐ข๐ž๐ง๐œ๐ž):-

๐Ÿ”น Q1. Identify Active Subscriptions in a Given Timeframe
Table: subscriptions(subscription_id, activation_date, deactivation_date)
Find all subscription_ids that were active at any point between '2010-01-01' and '2020-12-31'.
(Note: If deactivation_date is NULL, consider it as still active.)

๐Ÿ”น Q2. Group Continuous Membership Records into Start & End Periods
Table: memberships(user_id, plan_id, valid_till)
This table contains monthly records for users.

Group rows into blocks where a user stayed continuously subscribed to the same plan without missing a month, and return:
user_id, plan_id, start_date, end_date for each such block.

๐Ÿ”น Q3. Count Logins Based on User Status & Lookback Window
Tables: users(user_id, is_active, offboarded_on)
logins(login_id, user_id, login_date)

For each user:
โ†’ If is_active = true, count logins in the last 12 months from '2023-12-01'
โ†’ If is_active = false, count logins in the 12 months before offboarded_on
Return: user_id, status, period_start, period_end, login_count

๐Ÿ”น Q4. Match First Interaction Channel with Final Conversion
Tables: touchpoints(user_id, channel, interaction_date)
conversions(user_id, converted_on, is_converted)

Among users who converted, find how many had their first interaction channel same as the one that led to conversion.
Use min & max interaction dates to identify first and last channels. Return the percentage of such users.

๐Ÿ”น Q5. Find Cross-Category Spenders in Last 6 Months
Tables:
purchases(user_id, product_id, purchase_date)
products(product_id, category)
Find users who bought products from at least 3 different categories in the last 6 months.
Return user_id and count of unique categories.

Tap โค๏ธ for more
  • โค 4
Post #1938 1.85K
SQL Join Types
  • โค 4
Post #1937 1.98K
SQL Essential Concepts for Data Analyst Interviews โœ…

1. SQL Syntax: Understand the basic structure of SQL queries, which typically include SELECT, FROM, WHERE, GROUP BY, HAVING, and ORDER BY clauses. Know how to write queries to retrieve data from databases.

2. SELECT Statement: Learn how to use the SELECT statement to fetch data from one or more tables. Understand how to specify columns, use aliases, and perform simple arithmetic operations within a query.

3. WHERE Clause: Use the WHERE clause to filter records based on specific conditions. Familiarize yourself with logical operators like =, >, <, >=, <=, <>, AND, OR, and NOT.

4. JOIN Operations: Master the different types of joinsโ€”INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOINโ€”to combine rows from two or more tables based on related columns.

5. GROUP BY and HAVING Clauses: Use the GROUP BY clause to group rows that have the same values in specified columns and aggregate data with functions like COUNT(), SUM(), AVG(), MAX(), and MIN(). The HAVING clause filters groups based on aggregate conditions.

6. ORDER BY Clause: Sort the result set of a query by one or more columns using the ORDER BY clause. Understand how to sort data in ascending (ASC) or descending (DESC) order.

7. Aggregate Functions: Be familiar with aggregate functions like COUNT(), SUM(), AVG(), MIN(), and MAX() to perform calculations on sets of rows, returning a single value.

8. DISTINCT Keyword: Use the DISTINCT keyword to remove duplicate records from the result set, ensuring that only unique records are returned.

9. LIMIT/OFFSET Clauses: Understand how to limit the number of rows returned by a query using LIMIT (or TOP in some SQL dialects) and how to paginate results with OFFSET.

10. Subqueries: Learn how to write subqueries, or nested queries, which are queries within another SQL query. Subqueries can be used in SELECT, WHERE, FROM, and HAVING clauses to provide more specific filtering or selection.

11. UNION and UNION ALL: Know the difference between UNION and UNION ALL. UNION combines the results of two queries and removes duplicates, while UNION ALL combines all results including duplicates.

12. IN, BETWEEN, and LIKE Operators: Use the IN operator to match any value in a list, the BETWEEN operator to filter within a range, and the LIKE operator for pattern matching with wildcards (%, _).

13. NULL Handling: Understand how to work with NULL values in SQL, including using IS NULL, IS NOT NULL, and handling nulls in calculations and joins.

14. CASE Statements: Use the CASE statement to implement conditional logic within SQL queries, allowing you to create new fields or modify existing ones based on specific conditions.

15. Indexes: Know the basics of indexing, including how indexes can improve query performance by speeding up the retrieval of rows. Understand when to create an index and the trade-offs in terms of storage and write performance.

16. Data Types: Be familiar with common SQL data types, such as VARCHAR, CHAR, INT, FLOAT, DATE, and BOOLEAN, and understand how to choose the appropriate data type for a column.

17. String Functions: Learn key string functions like CONCAT(), SUBSTRING(), REPLACE(), LENGTH(), TRIM(), and UPPER()/LOWER() to manipulate text data within queries.

18. Date and Time Functions: Master date and time functions such as NOW(), CURDATE(), DATEDIFF(), DATEADD(), and EXTRACT() to handle and manipulate date and time data effectively.

19. INSERT, UPDATE, DELETE Statements: Understand how to use INSERT to add new records, UPDATE to modify existing records, and DELETE to remove records from a table. Be aware of the implications of these operations, particularly in maintaining data integrity.

20. Constraints: Know the role of constraints like PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, and CHECK in maintaining data integrity and ensuring valid data entry in your database.

Here you can find SQL Interview Resources๐Ÿ‘‡
https://t.me/DataSimplifier

Share with credits: https://t.me/sqlspecialist

Hope it helps :)
  • โค 5
Post #1935 2.15K
Data Analyst Cheatsheet ๐Ÿ’ช
  • โค 5
  • ๐Ÿ‘ 1
Post #1934 2.03K
๐—ฆ๐—ค๐—Ÿ ๐—–๐—ต๐—ฒ๐—ฎ๐˜ ๐—ฆ๐—ต๐—ฒ๐—ฒ๐˜
  • โค 3
  • ๐Ÿ˜ 2
Post #1932 2.31K
๐Ÿ”ฅ Top SQL Projects for Data Analytics ๐Ÿš€

If you're preparing for a Data Analyst role or looking to level up your SQL skills, working on real-world projects is the best way to learn!

Here are some must-do SQL projects to strengthen your portfolio. ๐Ÿ‘‡

๐ŸŸข Beginner-Friendly SQL Projects (Great for Learning Basics)

โœ… Employee Database Management โ€“ Build and query HR data ๐Ÿ“Š
โœ… Library Book Tracking โ€“ Create a database for book loans and returns
โœ… Student Grading System โ€“ Analyze student performance data
โœ… Retail Point-of-Sale System โ€“ Work with sales and transactions ๐Ÿ’ฐ
โœ… Hotel Booking System โ€“ Manage customer bookings and check-ins ๐Ÿจ

๐ŸŸก Intermediate SQL Projects (For Stronger Querying & Analysis)

โšก E-commerce Order Management โ€“ Analyze order trends & customer data ๐Ÿ›’
โšก Sales Performance Analysis โ€“ Work with revenue, profit margins & KPIs ๐Ÿ“ˆ
โšก Inventory Control System โ€“ Optimize stock tracking ๐Ÿ“ฆ
โšก Real Estate Listings โ€“ Manage and analyze property data ๐Ÿก
โšก Movie Rating System โ€“ Analyze user reviews & trends ๐ŸŽฌ

๐Ÿ”ต Advanced SQL Projects (For Business-Level Analytics)

๐Ÿ”น Social Media Analytics โ€“ Track user engagement & content trends
๐Ÿ”น Insurance Claim Management โ€“ Fraud detection & risk assessment
๐Ÿ”น Customer Feedback Analysis โ€“ Perform sentiment analysis on reviews โญ
๐Ÿ”น Freelance Job Platform โ€“ Match freelancers with project opportunities
๐Ÿ”น Pharmacy Inventory System โ€“ Optimize stock levels & prescriptions

๐Ÿ”ด Expert-Level SQL Projects (For Data-Driven Decision Making)

๐Ÿ”ฅ Music Streaming Analysis โ€“ Study user behavior & song trends ๐ŸŽถ
๐Ÿ”ฅ Healthcare Prescription Tracking โ€“ Identify patterns in medicine usage
๐Ÿ”ฅ Employee Shift Scheduling โ€“ Optimize workforce efficiency โณ
๐Ÿ”ฅ Warehouse Stock Control โ€“ Manage supply chain data efficiently
๐Ÿ”ฅ Online Auction System โ€“ Analyze bidding patterns & sales performance ๐Ÿ›๏ธ

๐Ÿ”— Pro Tip: If you're applying for Data Analyst roles, pick 3-4 projects, clean the data, and create interactive dashboards using Power BI/Tableau to showcase insights!

React with โ™ฅ๏ธ if you want detailed explanation of each project

Share with credits: ๐Ÿ‘‡ https://t.me/sqlspecialist

Hope it helps :)
  • โค 8
Post #1930 2.61K
Essential Skills Excel for Data Analysts ๐Ÿš€

1๏ธโƒฃ Data Cleaning & Transformation

Remove Duplicates โ€“ Ensure unique records.
Find & Replace โ€“ Quick data modifications.
Text Functions โ€“ TRIM, LEN, LEFT, RIGHT, MID, PROPER.
Data Validation โ€“ Restrict input values.

2๏ธโƒฃ Data Analysis & Manipulation

Sorting & Filtering โ€“ Organize and extract key insights.
Conditional Formatting โ€“ Highlight trends, outliers.
Pivot Tables โ€“ Summarize large datasets efficiently.
Power Query โ€“ Automate data transformation.

3๏ธโƒฃ Essential Formulas & Functions

Lookup Functions โ€“ VLOOKUP, HLOOKUP, XLOOKUP, INDEX-MATCH.
Logical Functions โ€“ IF, AND, OR, IFERROR, IFS.
Aggregation Functions โ€“ SUM, AVERAGE, MIN, MAX, COUNT, COUNTA.
Text Functions โ€“ CONCATENATE, TEXTJOIN, SUBSTITUTE.

4๏ธโƒฃ Data Visualization
Charts & Graphs โ€“ Bar, Line, Pie, Scatter, Histogram.

Sparklines โ€“ Miniature charts inside cells.
Conditional Formatting โ€“ Color scales, data bars.
Dashboard Creation โ€“ Interactive and dynamic reports.

5๏ธโƒฃ Advanced Excel Techniques
Array Formulas โ€“ Dynamic calculations with multiple values.
Power Pivot & DAX โ€“ Advanced data modeling.
What-If Analysis โ€“ Goal Seek, Scenario Manager.
Macros & VBA โ€“ Automate repetitive tasks.

6๏ธโƒฃ Data Import & Export
CSV & TXT Files โ€“ Import and clean raw data.
Power Query โ€“ Connect to databases, web sources.
Exporting Reports โ€“ PDF, CSV, Excel formats.

Here you can find some free Excel books & useful resources: https://t.me/excel_data

Hope it helps :)

#dataanalyst
  • โค 11
Post #1928 2.2K
Here are some commonly asked SQL interview questions along with brief answers:

1. What is SQL?
- SQL stands for Structured Query Language, used for managing and manipulating relational databases.

2. What are the types of SQL commands?
- SQL commands can be broadly categorized into four types: Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), and Transaction Control Language (TCL).

3. What is the difference between CHAR and VARCHAR data types?
- CHAR is a fixed-length character data type, while VARCHAR is a variable-length character data type. CHAR will always occupy the same amount of storage space, while VARCHAR will only use the necessary space to store the actual data.

4. What is a primary key?
- A primary key is a column or a set of columns that uniquely identifies each row in a table. It ensures data integrity by enforcing uniqueness and can be used to establish relationships between tables.

5. What is a foreign key?
- A foreign key is a column or a set of columns in one table that refers to the primary key in another table. It establishes a relationship between two tables and ensures referential integrity.

6. What is a JOIN in SQL?
- JOIN is used to combine rows from two or more tables based on a related column between them. There are different types of JOINs, including INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.

7. What is the difference between INNER JOIN and OUTER JOIN?
- INNER JOIN returns only the rows that have matching values in both tables, while OUTER JOIN (LEFT, RIGHT, FULL) returns all rows from one or both tables, with NULL values in columns where there is no match.

8. What is the difference between GROUP BY and ORDER BY?
- GROUP BY is used to group rows that have the same values into summary rows, typically used with aggregate functions like SUM, COUNT, AVG, etc., while ORDER BY is used to sort the result set based on one or more columns.

9. What is a subquery?
- A subquery is a query nested within another query, used to return data that will be used in the main query. Subqueries can be used in SELECT, INSERT, UPDATE, and DELETE statements.

10. What is normalization in SQL?
- Normalization is the process of organizing data in a database to reduce redundancy and dependency. It involves dividing large tables into smaller tables and defining relationships between them to improve data integrity and efficiency.

Around 90% questions will be asked from sql in data analytics interview, so please make sure to practice SQL skills using websites like stratascratch. โ˜บ๏ธ๐Ÿ’ช
  • โค 2
Post #1926 2.51K
Few ways to optimise SQL Queries ๐Ÿ‘‡๐Ÿ‘‡

Use Indexing: Properly indexing your database tables can significantly speed up query performance by allowing the database to quickly locate the rows needed for a query.

Optimize Joins: Minimize the number of joins and use appropriate join types (e.g., INNER JOIN, LEFT JOIN) to ensure efficient data retrieval.

Avoid SELECT * : Instead of selecting all columns using SELECT *, explicitly specify only the columns needed for the query to reduce unnecessary data transfer and processing overhead.

Use WHERE Clause Wisely: Filter rows early in the query using WHERE clause to reduce the dataset size before joining or aggregating data.

Avoid Subqueries: Whenever possible, rewrite subqueries as JOINs or use Common Table Expressions (CTEs) for better performance.

Limit the Use of DISTINCT: Minimize the use of DISTINCT as it requires sorting and duplicate removal, which can be resource-intensive for large datasets.

Optimize GROUP BY and ORDER BY: Use GROUP BY and ORDER BY clauses judiciously, and ensure that they are using indexed columns whenever possible to avoid unnecessary sorting.

Consider Partitioning: Partition large tables to distribute data across multiple nodes, which can improve query performance by reducing I/O operations.

Monitor Query Performance: Regularly monitor query performance using tools like query execution plans, database profiler, and performance monitoring tools to identify and address bottlenecks.

Hope it helps :)
  • โค 4
Post #1924 2.53K
The Only SQL You Actually Need For Your First Job (Data Analytics)

The Learning Trap: What Most Beginners Fall Into

When starting out, it's common to feel like you need to master every possible SQL concept. You binge YouTube videos, tutorials, and courses, yet still feel lost in interviews or when given a real dataset.

Common traps:

- Complex subqueries

- Advanced CTEs

- Recursive queries

- 100+ tutorials watched

- 0 practical experience


Reality Check: What You'll Actually Use 75% of the Time

Most data analytics roles (especially entry-level) require clarity, speed, and confidence with core SQL operations. Hereโ€™s what covers most daily work:

1. SELECT, FROM, WHERE โ€” The Foundation

SELECT name, age
FROM employees
WHERE department = 'Finance';

This is how almost every query begins. Whether exploring a dataset or building a dashboard, these are always in use.

2. JOINs โ€” Combining Data From Multiple Tables

SELECT e.name, d.department_name
FROM employees e
JOIN departments d ON e.department_id = d.id;

Youโ€™ll often join tables like employee data with department, customer orders with payments, etc.

3. GROUP BY โ€” Summarizing Data

SELECT department, COUNT(*) AS employee_count
FROM employees
GROUP BY department;

Used to get summaries by categories like sales per region or users by plan.

4. ORDER BY โ€” Sorting Results

SELECT name, salary
FROM employees
ORDER BY salary DESC;

Helps sort output for dashboards or reports.

5. Aggregations โ€” Simple But Powerful

Common functions: COUNT(), SUM(), AVG(), MIN(), MAX()

SELECT AVG(salary)
FROM employees
WHERE department = 'IT';

Gives quick insights like average deal size or total revenue.

6. ROW_NUMBER() โ€” Adding Row Logic

SELECT *
FROM (
SELECT *, ROW_NUMBER() OVER(PARTITION BY customer_id ORDER BY order_date DESC) as rn
FROM orders
) sub
WHERE rn = 1;

Used for deduplication, rankings, or selecting the latest record per group.

Credits: https://whatsapp.com/channel/0029VaGgzAk72WTmQFERKh02

React โค๏ธ for more
  • โค 8
Post #1922 2.66K
Quick Recap of SQL Concepts

1๏ธโƒฃ FROM clause: Identifies the tables from which data will be retrieved.

2๏ธโƒฃ WHERE clause: Filters rows that meet certain conditions, narrowing down the dataset.

3๏ธโƒฃ GROUP BY clause: Organizes identical values into groups, often used with aggregate functions.

4๏ธโƒฃ HAVING clause: Applies filters on groups created by the GROUP BY clause.

5๏ธโƒฃ SELECT clause: Specifies which columns or expressions to display in the query results.

6๏ธโƒฃ WINDOW functions: Perform row-wise calculations without collapsing the data, like ROW_NUMBER, RANK, LAG.

7๏ธโƒฃ AGGREGATE functions: Includes SUM, COUNT, AVG, and others, used for summarizing data.

8๏ธโƒฃ UNION / UNION ALL: Merges results from multiple queries into a single result set. UNION removes duplicates, while UNION ALL keeps them.

9๏ธโƒฃ ORDER BY clause: Arranges the result set in ascending or descending order based on one or more columns.

๐Ÿ”Ÿ LIMIT / OFFSET (or FETCH / OFFSET): Limits the number of rows returned and specifies the starting row for pagination.

Here you can find SQL Interview Resources๐Ÿ‘‡
https://t.me/DataSimplifier

Share with credits: https://t.me/sqlspecialist

Hope it helps :)
  • โค 5
  • ๐Ÿ˜ 1
Post #1920 2.34K
  • โค 2
Post #1915 2.52K
30 Days Python Roadmap for Data Analysts ๐Ÿ‘†
  • โค 2
Post #1913 2.8K
Here are some advanced SQL techniques that are game-changers

Window Functions: Learn how to use OVER() for advanced analytics tasks. They are crucial for calculating running totals, rankings, and lead-lag analysis in datasets.

CTEs and Temp Tables: Common Table Expressions (CTEs) and temporary tables can simplify complex queries, especially when dealing with large datasets.

Dynamic SQL: Understand how to construct SQL queries dynamically to increase the flexibility of your database interactions.

Optimizing Queries for Performance: Explore how indexing, query restructuring, and understanding execution plans can drastically improve your query performance.

Using PIVOT and UNPIVOT: These operations are key for converting rows to columns and vice versa, making data more readable and analysis-friendly. If you're looking to deepen your SQL knowledge, these areas are a great start.
  • โค 5
Post #1912 3.81K
๐Ÿ“˜ SQL Challenges for Data Analytics โ€“ With Explanation ๐Ÿง 

(Beginner โžก๏ธ Advanced)

1๏ธโƒฃ Select Specific Columns

SELECT name, email FROM users;



This fetches only the name and email columns from the users table.

โœ”๏ธ Used when you donโ€™t want all columns from a table.


2๏ธโƒฃ Filter Records with WHERE

SELECT * FROM users WHERE age > 30;



The WHERE clause filters rows where age is greater than 30.

โœ”๏ธ Used for applying conditions on data.


3๏ธโƒฃ ORDER BY Clause

SELECT * FROM users ORDER BY registered_at DESC;



Sorts all users based on registered_at in descending order.
โœ”๏ธ Helpful to get latest data first.


4๏ธโƒฃ Aggregate Functions (COUNT, AVG)

SELECT COUNT(*) AS total_users, AVG(age) AS avg_age FROM users;


Explanation:
- COUNT(*) counts total rows (users).
- AVG(age) calculates the average age.
โœ”๏ธ Used for quick stats from tables.


5๏ธโƒฃ GROUP BY Usage

SELECT city, COUNT(*) AS user_count FROM users GROUP BY city;

Groups data by city and counts users in each group.

โœ”๏ธ Use when you want grouped summaries.


6๏ธโƒฃ JOIN Tables

SELECT users.name, orders.amount  
FROM users
JOIN orders ON users.id = orders.user_id;



Fetches user names along with order amounts by joining users and orders on matching IDs.
โœ”๏ธ Essential when combining data from multiple tables.


7๏ธโƒฃ Use of HAVING

SELECT city, COUNT(*) AS total  
FROM users
GROUP BY city
HAVING COUNT(*) > 5;



Like WHERE, but used with aggregates. This filters cities with more than 5 users.
โœ”๏ธ **Use HAVING after GROUP BY.**


8๏ธโƒฃ Subqueries

SELECT * FROM users  
WHERE salary > (SELECT AVG(salary) FROM users);



Finds users whose salary is above the average. The subquery calculates the average salary first.

โœ”๏ธ Nested queries for dynamic filtering9๏ธโƒฃ CASE Statementnt**

SELECT name,  
CASE
WHEN age < 18 THEN 'Teen'
WHEN age <= 40 THEN 'Adult'
ELSE 'Senior'
END AS age_group
FROM users;



Adds a new column that classifies users into categories based on age.
โœ”๏ธ Powerful for conditional logic.

๐Ÿ”Ÿ Window Functions (Advanced)

SELECT name, city, score,  
RANK() OVER (PARTITION BY city ORDER BY score DESC) AS rank
FROM users;



Ranks users by score *within each city*.

SQL Learning Series: https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v/1075
  • โค 12
Older posts โ†’
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’