Data Science & Machine Learning
77.8K subscribers
913 photos
1 video
68 files
833 links
Join this channel to learn data science, artificial intelligence and machine learning with funny quizzes, interesting projects and amazing resources for free

For collaborations: @love_data
Download Telegram
ORDER BY salary DESC
LIMIT 5;


Mistake 3 — Forgetting that LIMIT applies after sorting

For a top-N analysis, think:

ORDER BY → LIMIT

not simply:

LIMIT → assume top records

🔹 Interview Questions

1. What is LIMIT?

LIMIT restricts the number of rows returned by a query.

2. How do you find the top 10 salaries?

SELECT *
FROM employees
ORDER BY salary DESC
LIMIT 10;


3. Can LIMIT be used with WHERE?

Yes.

SELECT *
FROM employees
WHERE department = 'Finance'
LIMIT 5;


4. Why is ORDER BY important when using LIMIT?

Because without sorting, the returned rows are not necessarily the highest, lowest, newest, or oldest records you want.

5. What is OFFSET used for?

OFFSET skips a specified number of rows before returning the requested rows, commonly for pagination.

🎯 Double Tap ❤️ For More
❤5
🎓 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝘄𝗶𝘁𝗵 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀! 🚀🔥

Upgrade your resume with Microsoft learning opportunities. Explore courses covering some of today's most in-demand tech skills!

🎯 Perfect for Students • Freshers • Job Seekers • Working Professionals

✅ Learn at your own pace ✅ Build career-relevant skills ✅ Explore available certificates and credentials

🔗 𝗔𝗰𝗰𝗲𝘀𝘀 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝗛𝗲𝗿𝗲 👇

https://pdlink.in/3Uf5trR

🔥 Share with friends looking to upskill in 2026!
❤1
🔬 Kandinsky 6.0 Video: Training Details and Architecture

The new Kandinsky 6.0 Video lineup — the flagship Pro (29B) and the lightweight Lite (3B) — uses a dual-stream architecture: a video stream and an audio stream connected by bidirectional cross-attention.

📚 Training methodology:
• Audio stream: pretrained from scratch on 40 million audio tracks; joint training: 7 million audio-video segments
• Selection criteria: high-quality sound, close-up shots of speaking people
• Objective: precise synchronization of speech and facial expressions

🏗 Architecture:
Two connected streams:
1. Video stream
2. Audio stream
The streams are connected by bidirectional cross-attention for temporal and semantic alignment.

🎯 Key capabilities:
• Lip-sync technology
• Wide audio range (speech, effects, ambient)
• Consumer GPU deployment (block offloading, 16–32 GB VRAM presets)
• Realistic physics modeling

📊 Performance metrics:
• vs Kandinsky 5.0: clear advantage across all criteria (visual quality, prompt adherence, camera movement)
• vs LTX 2.5: preferred in visual quality and speech quality
• vs Veo 3.1 Fast: superior in image animation tasks

🔧 Specifications:
• Resolutions: SD, HD, Full HD
• Audio quality: 44 kHz
• Duration: up to 5 seconds
• License: MIT

🔗 Hugging Face
❤4
🇮🇳 𝗚𝗢𝗩𝗘𝗥𝗡𝗠𝗘𝗡𝗧 𝗢𝗙 𝗜𝗡𝗗𝗜𝗔 — 𝗔𝗜𝗖𝗧𝗘 𝗜𝗡𝗧𝗘𝗥𝗡𝗦𝗛𝗜𝗣𝗦 𝟮𝟬𝟮𝟲 🚀

Students and freshers can explore internship opportunities through the AICTE Internship Portal across multiple domains:

💻 AI, Data Science & Web Development
📈 Digital Marketing & Business Development
💰 Finance & Accounting
✍️ Content Writing & Graphic Design
⚙️ Mechanical, Civil & Electrical Engineering

🔗 𝗖𝗵𝗲𝗰𝗸 𝗢𝗽𝗽𝗼𝗿𝘁𝘂𝗻𝗶𝘁𝗶𝗲𝘀 & 𝗔𝗽𝗽𝗹𝘆 👇

https://pdlink.in/4y3vcBl

📢 Share this opportunity with your friends and classmates!
❤4
🚀 𝗪𝗵𝗶𝗰𝗵 𝗧𝗲𝗰𝗵 𝗦𝗸𝗶𝗹𝗹 𝗪𝗶𝗹𝗹 𝗬𝗼𝘂 𝗠𝗮𝘀𝘁𝗲𝗿 𝗶𝗻 𝟮𝟬𝟮𝟲?

Want to build apps, uncover insights, or create AI solutions? Explore certification courses that match your career goals! 🎯

💻 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗗𝗲𝘃𝗲𝗹𝗼𝗽𝗺𝗲𝗻𝘁
👉 https://pdlink.in/3SuUeuD

📊 𝗗𝗮𝘁𝗮 𝗔𝗻𝗮𝗹𝘆𝘁𝗶𝗰𝘀
👉 https://pdlink.in/45vk5ph

💫𝗔𝗜 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿𝗶𝗻𝗴
👉 https://pdlink.in/4fWJVID

🔥 Choose your path, sharpen your skills, and take the next step towards your tech career!

📌 Save this post & share it with a friend planning to upskill.
❤3
🚀 Data Science Roadmap 2026

📍 Phase 3: SQL for Data Science

📖 Topic 6 — GROUP BY

GROUP BY is used to group rows that have the same value in one or more columns.

It is mainly used when you want to perform calculations for each group.

For example:

• Total sales by region

• Average salary by department

• Number of customers by city

• Total orders by product

• Maximum transaction by category

🔹 Basic Syntax

SELECT column_name, aggregate_function(column_name)
FROM table_name
GROUP BY column_name;


Common aggregate functions:

• COUNT() → Count rows

• SUM() → Calculate total

• AVG() → Calculate average

• MIN() → Find minimum

• MAX() → Find maximum

🔹 Simple Example

Suppose we have:

department   salary
IT 60000
IT 80000
HR 50000
HR 70000
Finance 90000


Query:

SELECT department, AVG(salary) AS avg_salary
FROM employees
GROUP BY department;


Result:

department   avg_salary
IT 70000
HR 60000
Finance 90000


Instead of calculating one overall average, SQL calculates an average for each department.

🔹 GROUP BY with COUNT()

To count employees in each department:

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


Result:

department   employee_count
IT 2
HR 2
Finance 1


🔹 GROUP BY with SUM()

Suppose you have sales data:

region   sales
North 10000
North 15000
South 20000
South 12000


Query:

SELECT region, SUM(sales) AS total_sales
FROM sales
GROUP BY region;


Result:

North   25000
South 32000


This is extremely common in business analytics.

🔹 GROUP BY with MAX()

Find the highest salary in each department:

SELECT department, MAX(salary) AS highest_salary
FROM employees
GROUP BY department;


🔹 GROUP BY with MIN()

Find the lowest salary in each department:

SELECT department, MIN(salary) AS lowest_salary
FROM employees
GROUP BY department;


🔹 GROUP BY with Multiple Columns

You can group by multiple columns.

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


Here SQL creates groups based on:

department + job_title

For example:

IT        Analyst       5
IT Developer 8
HR Analyst 3
Finance Manager 4


🔹 GROUP BY with WHERE

WHERE filters rows before grouping.

SELECT department, AVG(salary) AS avg_salary
FROM employees
WHERE salary > 50000
GROUP BY department;


🔹 GROUP BY with ORDER BY

You can sort grouped results.

For example, find departments with the highest total salary first:

SELECT department, SUM(salary) AS total_salary
FROM employees
GROUP BY department
ORDER BY total_salary DESC;


This is very useful for ranking groups.

🔹 GROUP BY vs DISTINCT

These two can sometimes look similar.

DISTINCT

SELECT DISTINCT department
FROM employees;


Used to find unique departments.

GROUP BY

SELECT department, COUNT(*)
FROM employees
GROUP BY department;
❤3
Used when you want to perform calculations for each department.

Simple rule:

DISTINCT → Give me unique values

GROUP BY → Give me groups so I can calculate something

🔹 Real-World Data Science Example

Imagine an e-commerce dataset.

You want to know the total revenue generated by each product category.

SELECT category,
SUM(quantity * price) AS total_revenue
FROM sales
GROUP BY category
ORDER BY total_revenue DESC;


This gives you a category-level summary that can be used for:

• Revenue analysis

• Product performance

• Business reporting

• Feature creation

• Exploratory data analysis

🔹 Common Mistake

Consider:

SELECT department, employee_name, AVG(salary)
FROM employees
GROUP BY department;


This can cause an error in many SQL databases because employee_name is neither:

• included in GROUP BY, nor

• used inside an aggregate function.

A valid query would be:

SELECT department, AVG(salary)
FROM employees
GROUP BY department;


🔹 Important Rule

When using GROUP BY, selected columns generally need to be either:

1. Included in the GROUP BY, or

2. Wrapped inside an aggregate function.

Example:

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


department → grouped column

COUNT(*) → aggregate

🔹 Interview Questions

1. What is GROUP BY?

GROUP BY groups rows with the same values so aggregate calculations can be performed for each group.

2. Which aggregate functions are commonly used with GROUP BY?

COUNT(), SUM(), AVG(), MIN(), and MAX().

3. What is the difference between WHERE and GROUP BY?

WHERE filters individual rows before grouping.

GROUP BY creates groups from the filtered rows.

4. Can GROUP BY use multiple columns?

Yes.

GROUP BY department, job_title;

5. Can GROUP BY be used without aggregate functions?

Yes, although DISTINCT is often clearer when the goal is simply to return unique combinations.

🎯 Practice Questions

1. Find the number of employees in each department.

2. Find the average salary for each department.

3. Find the total sales for each region.

4. Find the highest salary in each department.

5. Find the total revenue for each product category and sort categories from highest to lowest revenue.

🎯 Key Takeaways

• GROUP BY creates groups of similar rows.

• It is commonly used with aggregate functions.

• COUNT() counts.

• SUM() totals.

• AVG() calculates averages.

• MIN() finds the minimum.

• MAX() finds the maximum.

• WHERE filters rows before grouping.

• ORDER BY can sort grouped results.

• GROUP BY is one of the most important SQL concepts for Data Science and Analytics.

📍Double Tap ❤️ For More
❤5
𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲!

Explore FREE online learning resources to develop in-demand skills and improve your career opportunities!

🎓 Why Explore These Courses?
✅ Learn valuable professional skills
✅ Improve your resume
✅ Build practical knowledge
✅ Learn at your own pace

𝗘𝘅𝗽𝗹𝗼𝗿𝗲 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝗛𝗲𝗿𝗲👇

https://pdlink.in/3VBdt6V

💡 Learn New Skills → Build Confidence → Unlock Career Opportunities!
❤1
Which aggregate function calculates the average salary?
Anonymous Quiz
5%
A) SUM()
5%
B) COUNT()
87%
C) AVG()
2%
D) TOTAL()
Which clause filters rows before GROUP BY?
Anonymous Quiz
22%
A) HAVING
34%
B) ORDER BY
42%
C) WHERE
3%
D) LIMIT
What does this query return?
SELECT department, SUM(salary) AS total_salary
FROM employees GROUP BY department;
Anonymous Quiz
14%
A) The highest salary in each department
12%
B) The average salary in each department
69%
C) The total salary for each department
5%
D) The number of employees in each department
𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍

Future Ready Data Science and AI Skills You Build

->Build Python, Machine Learning, and AI Skills
->Get Mentored by Industry Experts
->Practice with Mock Interviews
->Ace Your Placements & Land Dream Tech Job

🤝 500+ Partner Companies |🎓 2000+ Students Placed

🔗 𝗥𝗲𝗴𝗶𝘀𝘁𝗲𝗿 𝗡𝗼𝘄 👇 :-

https://pdlink.in/47pezFz

📲 Save & Share with Friends Preparing for Data Science & AI Jobs!
❤1