❌ Mistake 2: Forgetting quotes around text
Incorrect:
Correct:
❌ Mistake 3: Using AND when you mean OR
Incorrect if you want either city:
A single city value cannot normally be both at the same time.
Correct:
Or:
❌ Mistake 4: Forgetting parentheses
For complex conditions, use parentheses:
❌ Mistake 5: Assuming BETWEEN excludes the boundaries
BETWEEN is generally inclusive.
🔹 34. Interview Questions
💡 What is the purpose of WHERE?
WHERE filters rows based on a condition.
💡 What is the difference between WHERE and SELECT?
SELECT → Determines what columns/expressions appear in the result.
WHERE → Determines which rows are included.
💡 How do you check for NULL?
Use:
IS NULL
or:
IS NOT NULL
💡 What is the difference between IN and OR?
IN provides a concise way to test whether a value matches any value in a list.
💡 Is BETWEEN inclusive?
Yes, BETWEEN generally includes both boundary values.
🎯 Practice Questions
Q1. Write a query to retrieve employees whose salary is greater than 50,000.
Q2. Write a query to retrieve customers from Pune or Mumbai.
Q3. Write a query to retrieve products priced between 1,000 and 5,000.
Q4. Write a query to retrieve customers whose phone number is missing.
Q5. Write a query to retrieve orders where the status is Success and the amount is greater than 10,000.
🎯 Key Takeaways
✅ WHERE is used to filter rows.
✅ = checks equality.
✅ <> and != can be used for not equal.
✅ AND requires all specified conditions to be true.
✅ OR requires at least one condition to be true.
✅ IN is useful for matching multiple values.
✅ BETWEEN is useful for ranges and is generally inclusive.
✅ LIKE is used for pattern matching.
✅ % represents a sequence of characters.
✅ _ represents one character.
✅ Use IS NULL and IS NOT NULL for NULL values.
✅ Parentheses make complex AND/OR logic clearer and safer.
🧭 Double Tap ❤️ For More
Incorrect:
WHERE city = Pune;
Correct:
WHERE city = 'Pune';
❌ Mistake 3: Using AND when you mean OR
Incorrect if you want either city:
WHERE city = 'Pune'
AND city = 'Mumbai';
A single city value cannot normally be both at the same time.
Correct:
WHERE city = 'Pune'
OR city = 'Mumbai';
Or:
WHERE city IN ('Pune', 'Mumbai');❌ Mistake 4: Forgetting parentheses
For complex conditions, use parentheses:
WHERE
(city = 'Pune' OR city = 'Mumbai')
AND age > 30;
❌ Mistake 5: Assuming BETWEEN excludes the boundaries
BETWEEN is generally inclusive.
🔹 34. Interview Questions
💡 What is the purpose of WHERE?
WHERE filters rows based on a condition.
💡 What is the difference between WHERE and SELECT?
SELECT → Determines what columns/expressions appear in the result.
WHERE → Determines which rows are included.
💡 How do you check for NULL?
Use:
IS NULL
or:
IS NOT NULL
💡 What is the difference between IN and OR?
IN provides a concise way to test whether a value matches any value in a list.
💡 Is BETWEEN inclusive?
Yes, BETWEEN generally includes both boundary values.
🎯 Practice Questions
Q1. Write a query to retrieve employees whose salary is greater than 50,000.
Q2. Write a query to retrieve customers from Pune or Mumbai.
Q3. Write a query to retrieve products priced between 1,000 and 5,000.
Q4. Write a query to retrieve customers whose phone number is missing.
Q5. Write a query to retrieve orders where the status is Success and the amount is greater than 10,000.
🎯 Key Takeaways
✅ WHERE is used to filter rows.
✅ = checks equality.
✅ <> and != can be used for not equal.
✅ AND requires all specified conditions to be true.
✅ OR requires at least one condition to be true.
✅ IN is useful for matching multiple values.
✅ BETWEEN is useful for ranges and is generally inclusive.
✅ LIKE is used for pattern matching.
✅ % represents a sequence of characters.
✅ _ represents one character.
✅ Use IS NULL and IS NOT NULL for NULL values.
✅ Parentheses make complex AND/OR logic clearer and safer.
🧭 Double Tap ❤️ For More
❤6
🚀 𝐁𝐞𝐜𝐨𝐦𝐞 𝐚𝐧 𝐀𝐈 𝐄𝐧𝐠𝐢𝐧𝐞𝐞𝐫 𝐢𝐧 𝟐𝟎𝟐𝟔
🎯 Choose Your Learning Track:
💻 Java Full Stack + AI Engineering
🌐 MERN Full Stack + AI Engineering
Placement Highlights: ₹41 LPA highest package | ₹7.4 LPA average package | 2,000+ students placed | 500+ hiring partners
🔗 𝗕𝗼𝗼𝗸 𝗙𝗥𝗘𝗘 𝗗𝗲𝗺𝗼 𝗖𝗹𝗮𝘀𝘀 :- https://pdlink.in/4fWJVID
⚡ AI is creating new career opportunities—start building the skills companies need in 2026!
🎯 Choose Your Learning Track:
💻 Java Full Stack + AI Engineering
🌐 MERN Full Stack + AI Engineering
Placement Highlights: ₹41 LPA highest package | ₹7.4 LPA average package | 2,000+ students placed | 500+ hiring partners
🔗 𝗕𝗼𝗼𝗸 𝗙𝗥𝗘𝗘 𝗗𝗲𝗺𝗼 𝗖𝗹𝗮𝘀𝘀 :- https://pdlink.in/4fWJVID
⚡ AI is creating new career opportunities—start building the skills companies need in 2026!
❤3
Important Excel, Tableau, Statistics, SQL related Questions with answers
1. What are the common problems that data analysts encounter during analysis?
The common problems steps involved in any analytics project are:
Handling duplicate data
Collecting the meaningful right data at the right time
Handling data purging and storage problems
Making data secure and dealing with compliance issues
2. Explain the Type I and Type II errors in Statistics?
In Hypothesis testing, a Type I error occurs when the null hypothesis is rejected even if it is true. It is also known as a false positive.
A Type II error occurs when the null hypothesis is not rejected, even if it is false. It is also known as a false negative.
3. How do you make a dropdown list in MS Excel?
First, click on the Data tab that is present in the ribbon.
Under the Data Tools group, select Data Validation.
Then navigate to Settings > Allow > List.
Select the source you want to provide as a list array.
4. How do you subset or filter data in SQL?
To subset or filter data in SQL, we use WHERE and HAVING clauses which give us an option of including only the data matching certain conditions.
5. What is a Gantt Chart in Tableau?
A Gantt chart in Tableau depicts the progress of value over the period, i.e., it shows the duration of events. It consists of bars along with the time axis. The Gantt chart is mostly used as a project management tool where each bar is a measure of a task in the project
1. What are the common problems that data analysts encounter during analysis?
The common problems steps involved in any analytics project are:
Handling duplicate data
Collecting the meaningful right data at the right time
Handling data purging and storage problems
Making data secure and dealing with compliance issues
2. Explain the Type I and Type II errors in Statistics?
In Hypothesis testing, a Type I error occurs when the null hypothesis is rejected even if it is true. It is also known as a false positive.
A Type II error occurs when the null hypothesis is not rejected, even if it is false. It is also known as a false negative.
3. How do you make a dropdown list in MS Excel?
First, click on the Data tab that is present in the ribbon.
Under the Data Tools group, select Data Validation.
Then navigate to Settings > Allow > List.
Select the source you want to provide as a list array.
4. How do you subset or filter data in SQL?
To subset or filter data in SQL, we use WHERE and HAVING clauses which give us an option of including only the data matching certain conditions.
5. What is a Gantt Chart in Tableau?
A Gantt chart in Tableau depicts the progress of value over the period, i.e., it shows the duration of events. It consists of bars along with the time axis. The Gantt chart is mostly used as a project management tool where each bar is a measure of a task in the project
❤4
🚀 𝗚𝗼𝗼𝗴𝗹𝗲 𝗣𝗿𝗼𝗳𝗲𝘀𝘀𝗶𝗼𝗻𝗮𝗹 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀 𝗶𝗻 𝗗𝗮𝘁𝗮 𝗔𝗻𝗮𝗹𝘆𝘁𝗶𝗰𝘀 & 𝗔𝗜! 📊
Explore these 4 Google learning programs and develop practical, career-relevant skills.
🎓 Explore the programs:
1️⃣ Google Data Analytics Professional Certificate
2️⃣ Google Business Intelligence Professional Certificate
3️⃣ Google AI Essentials
4️⃣ Google Advanced Data Analytics Professional Certificate
🔗 𝗘𝗻𝗿𝗼𝗹𝗹 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘 👇:-
https://pdlink.in/4htgIEW
📌 Save this post and share it with someone interested in Data Analytics or AI!
Explore these 4 Google learning programs and develop practical, career-relevant skills.
🎓 Explore the programs:
1️⃣ Google Data Analytics Professional Certificate
2️⃣ Google Business Intelligence Professional Certificate
3️⃣ Google AI Essentials
4️⃣ Google Advanced Data Analytics Professional Certificate
🔗 𝗘𝗻𝗿𝗼𝗹𝗹 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘 👇:-
https://pdlink.in/4htgIEW
📌 Save this post and share it with someone interested in Data Analytics or AI!
❤5
Which query correctly retrieves employees whose salary is greater than 50,000?
Anonymous Quiz
10%
A) SELECT * FROM employees WHERE salary < 50000;
3%
B) SELECT * FROM employees WHERE salary = 50000;
13%
C) SELECT * FROM employees WHERE salary >= 50000;
73%
D) SELECT * FROM employees WHERE salary > 50000;
❤1
Which query returns customers from either Pune or Mumbai?
Anonymous Quiz
18%
A) WHERE city = 'Pune' AND city = 'Mumbai'
66%
B) WHERE city IN ('Pune', 'Mumbai')
6%
C) WHERE city <> 'Pune' AND city <> 'Mumbai'
10%
D) WHERE city BETWEEN 'Pune' AND 'Mumbai'
❤2
How do you find rows where the phone number is missing?
Anonymous Quiz
9%
A) WHERE phone = NULL
22%
B) WHERE phone == NULL
64%
C) WHERE phone IS NULL
4%
D) WHERE phone IN NULL
❤1
What does this condition return?
WHERE age BETWEEN 25 AND 30
WHERE age BETWEEN 25 AND 30
Anonymous Quiz
48%
Ages greater than 25 and less than 30 only
45%
Ages from 25 through 30, including both 25 and 30
5%
Only ages exactly 25 and 30
2%
Ages below 25 or above 30
❤1
Which LIKE pattern finds names that begin with the letter A?
Anonymous Quiz
35%
A) LIKE '%A'
7%
B) LIKE '_A%'
44%
C) LIKE 'A%'
14%
D) LIKE '%A%'
❤1
𝗟𝗲𝘃𝗲𝗹 𝗨𝗽 𝗬𝗼𝘂𝗿 𝗦𝗸𝗶𝗹𝗹𝘀 𝘄𝗶𝘁𝗵 𝗧𝗵𝗲𝘀𝗲 𝗚𝗮𝗺𝗲-𝗖𝗵𝗮𝗻𝗴𝗶𝗻𝗴 𝗖𝗼𝘂𝗿𝘀𝗲𝘀!
Looking to learn practical, in-demand skills? These courses cover Generative AI, Cybersecurity, AI tools and Digital Marketing.
💫 Learn at your own pace
⚡Build career-relevant skills
🔥Practical learning opportunities
𝗘𝘅𝗽𝗹𝗼𝗿𝗲 𝘁𝗵𝗲 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 :-
https://pdlink.in/4z3vOYU
Save this post and share with your friends
Looking to learn practical, in-demand skills? These courses cover Generative AI, Cybersecurity, AI tools and Digital Marketing.
💫 Learn at your own pace
⚡Build career-relevant skills
🔥Practical learning opportunities
𝗘𝘅𝗽𝗹𝗼𝗿𝗲 𝘁𝗵𝗲 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 :-
https://pdlink.in/4z3vOYU
Save this post and share with your friends
❤4
Complete Data Analytics Mastery: From Basics to Advanced 🚀
Begin your Data Analytics journey by mastering the fundamentals:
- Understanding Data Types and Formats
- Basics of Exploratory Data Analysis (EDA)
- Introduction to Data Cleaning Techniques
- Statistical Foundations for Data Analytics
- Data Visualization Essentials
Grasp these essentials in just a week to build a solid foundation in data analytics.
Once you're comfortable, dive into intermediate topics:
- Advanced Data Visualization (using tools like Tableau)
- Hypothesis Testing and A/B Testing
- Regression Analysis
- Time Series Analysis for Analytics
- SQL for Data Analytics
Take another week to solidify these skills and enhance your ability to draw meaningful insights from data.
Ready for the advanced level? Explore cutting-edge concepts:
- Machine Learning for Data Analytics
- Predictive Analytics
- Big Data Analytics (Hadoop, Spark)
- Advanced Statistical Methods (Multivariate Analysis)
- Data Ethics and Privacy in Analytics
These advanced concepts can be mastered in a couple of weeks with focused study and practice.
Remember, mastery comes with hands-on experience:
- Work on a simple data analytics project
- Tackle an intermediate-level analysis task
- Challenge yourself with an advanced analytics project involving real-world data sets
Consistent practice and application of analytics techniques are the keys to becoming a data analytics pro.
Best platforms to learn:
- SQL courses with Certificate
- Freecodecamp Python Course
- 365DataScience
- Data Analyst Interview Questions
- Free SQL Resources
Share your progress and insights with others in the data analytics community. Enjoy the fascinating journey into the realm of data analytics! 👩💻👨💻
Join @free4unow_backup for more free resources.
Like this post if it helps 😄❤️
ENJOY LEARNING 👍👍
Begin your Data Analytics journey by mastering the fundamentals:
- Understanding Data Types and Formats
- Basics of Exploratory Data Analysis (EDA)
- Introduction to Data Cleaning Techniques
- Statistical Foundations for Data Analytics
- Data Visualization Essentials
Grasp these essentials in just a week to build a solid foundation in data analytics.
Once you're comfortable, dive into intermediate topics:
- Advanced Data Visualization (using tools like Tableau)
- Hypothesis Testing and A/B Testing
- Regression Analysis
- Time Series Analysis for Analytics
- SQL for Data Analytics
Take another week to solidify these skills and enhance your ability to draw meaningful insights from data.
Ready for the advanced level? Explore cutting-edge concepts:
- Machine Learning for Data Analytics
- Predictive Analytics
- Big Data Analytics (Hadoop, Spark)
- Advanced Statistical Methods (Multivariate Analysis)
- Data Ethics and Privacy in Analytics
These advanced concepts can be mastered in a couple of weeks with focused study and practice.
Remember, mastery comes with hands-on experience:
- Work on a simple data analytics project
- Tackle an intermediate-level analysis task
- Challenge yourself with an advanced analytics project involving real-world data sets
Consistent practice and application of analytics techniques are the keys to becoming a data analytics pro.
Best platforms to learn:
- SQL courses with Certificate
- Freecodecamp Python Course
- 365DataScience
- Data Analyst Interview Questions
- Free SQL Resources
Share your progress and insights with others in the data analytics community. Enjoy the fascinating journey into the realm of data analytics! 👩💻👨💻
Join @free4unow_backup for more free resources.
Like this post if it helps 😄❤️
ENJOY LEARNING 👍👍
❤4
🎓 𝗛𝗔𝗥𝗩𝗔𝗥𝗗 𝗨𝗡𝗜𝗩𝗘𝗥𝗦𝗜𝗧𝗬 𝗙𝗥𝗘𝗘 𝗢𝗡𝗟𝗜𝗡𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 😍
Dreaming of learning from one of the world’s most prestigious universities? Explore Harvard’s online courses and build valuable, career-ready skills from home!
💡 Beginner-friendly options
⏰ Learn at your own pace
🌍 Accessible online worldwide
🎯 Ideal for students, freshers and working professionals
🔗 𝗘𝘅𝗽𝗹𝗼𝗿𝗲 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 👇
https://pdlink.in/4xPUdzU
📢 Share this valuable opportunity with your friends and classmates!
Dreaming of learning from one of the world’s most prestigious universities? Explore Harvard’s online courses and build valuable, career-ready skills from home!
💡 Beginner-friendly options
⏰ Learn at your own pace
🌍 Accessible online worldwide
🎯 Ideal for students, freshers and working professionals
🔗 𝗘𝘅𝗽𝗹𝗼𝗿𝗲 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 👇
https://pdlink.in/4xPUdzU
📢 Share this valuable opportunity with your friends and classmates!
❤1
🚀 Data Science Roadmap 2026
📍 Phase 3: SQL for Data Science
📖 Topic 3 — ORDER BY
ORDER BY is used to sort the rows returned by a SQL query. It helps you arrange data in a meaningful order, such as:
• Highest salary to lowest salary
• Lowest price to highest price
• Newest date to oldest date
• A–Z or Z–A
• Highest sales to lowest sales
🔹 Basic Syntax
By default, SQL sorts in ascending order.
This generally returns employees from the lowest salary to the highest salary.
🔹 ASC — Ascending Order
ASC means ascending.
For numbers: 10000, 25000, 40000, 75000, 100000
For text: Amazon, Apple, Google, Microsoft
For dates: 2024-01-01, 2024-05-15, 2024-12-20, 2025-03-10
ASC is usually the default, so
🔹 DESC — Descending Order
DESC means descending.
Example: 100000, 75000, 40000, 25000, 10000
This is especially useful when you want to find:
• Highest-paid employees
• Top-selling products
• Most expensive products
• Most recent transactions
• Highest-performing regions
🔹 Sorting Text
You can sort text columns alphabetically.
🔹 Sorting Dates
To find the most recent transactions:
To see transactions from oldest to newest:
🔹 Sorting by Multiple Columns
This is very important. Suppose you want to sort employees:
1. By department
2. Within each department, by salary from highest to lowest
SQL first sorts by department. When multiple rows have the same department, it then uses salary to determine their order.
Example:
Finance 90000
Finance 70000
Finance 50000
HR 85000
HR 60000
IT 120000
IT 95000
🔹 ORDER BY with Calculations
You can also sort using an expression.
You can also use the alias in many SQL databases:
🔹 ORDER BY with DISTINCT
This returns each department once and sorts them alphabetically.
🔹 ORDER BY and NULL Values
NULL represents a missing or unknown value. The position of NULL values when using ORDER BY can vary between SQL databases.
Some databases also support explicit control such as:
or
Always check the syntax supported by your SQL database.
🔹 ORDER BY with WHERE
WHERE filters the rows first, and ORDER BY sorts the resulting rows.
📍 Phase 3: SQL for Data Science
📖 Topic 3 — ORDER BY
ORDER BY is used to sort the rows returned by a SQL query. It helps you arrange data in a meaningful order, such as:
• Highest salary to lowest salary
• Lowest price to highest price
• Newest date to oldest date
• A–Z or Z–A
• Highest sales to lowest sales
🔹 Basic Syntax
SELECT column1, column2
FROM table_name
ORDER BY column_name;
By default, SQL sorts in ascending order.
SELECT *
FROM employees
ORDER BY salary;
This generally returns employees from the lowest salary to the highest salary.
🔹 ASC — Ascending Order
ASC means ascending.
SELECT *
FROM employees
ORDER BY salary ASC;
For numbers: 10000, 25000, 40000, 75000, 100000
For text: Amazon, Apple, Google, Microsoft
For dates: 2024-01-01, 2024-05-15, 2024-12-20, 2025-03-10
ASC is usually the default, so
ORDER BY salary; is equivalent to ORDER BY salary ASC;🔹 DESC — Descending Order
DESC means descending.
SELECT *
FROM employees
ORDER BY salary DESC;
Example: 100000, 75000, 40000, 25000, 10000
This is especially useful when you want to find:
• Highest-paid employees
• Top-selling products
• Most expensive products
• Most recent transactions
• Highest-performing regions
🔹 Sorting Text
You can sort text columns alphabetically.
SELECT employee_name, department
FROM employees
ORDER BY employee_name ASC;
SELECT employee_name, department
FROM employees
ORDER BY employee_name DESC;
🔹 Sorting Dates
To find the most recent transactions:
SELECT transaction_id, transaction_date, amount
FROM transactions
ORDER BY transaction_date DESC;
To see transactions from oldest to newest:
SELECT transaction_id, transaction_date, amount
FROM transactions
ORDER BY transaction_date ASC;
🔹 Sorting by Multiple Columns
This is very important. Suppose you want to sort employees:
1. By department
2. Within each department, by salary from highest to lowest
SELECT employee_name, department, salary
FROM employees
ORDER BY department ASC, salary DESC;
SQL first sorts by department. When multiple rows have the same department, it then uses salary to determine their order.
Example:
Finance 90000
Finance 70000
Finance 50000
HR 85000
HR 60000
IT 120000
IT 95000
🔹 ORDER BY with Calculations
You can also sort using an expression.
SELECT product_name, quantity, price,
quantity * price AS total_value
FROM products
ORDER BY quantity * price DESC;
You can also use the alias in many SQL databases:
SELECT product_name,
quantity * price AS total_value
FROM products
ORDER BY total_value DESC;
🔹 ORDER BY with DISTINCT
SELECT DISTINCT department
FROM employees
ORDER BY department ASC;
This returns each department once and sorts them alphabetically.
🔹 ORDER BY and NULL Values
NULL represents a missing or unknown value. The position of NULL values when using ORDER BY can vary between SQL databases.
Some databases also support explicit control such as:
ORDER BY salary ASC NULLS LAST;
or
ORDER BY salary DESC NULLS FIRST;
Always check the syntax supported by your SQL database.
🔹 ORDER BY with WHERE
WHERE filters the rows first, and ORDER BY sorts the resulting rows.
SELECT employee_name, salary
FROM employees
WHERE department = 'IT'
ORDER BY salary DESC;
❤1
🔹 Real-World Data Science Example
Suppose you are analyzing sales data. You want to identify the highest-value transactions.
This can help with:
• Finding high-value transactions
• Identifying important customers
• Investigating unusually large purchases
• Preparing data for further analysis
🔹 Common Mistakes
Mistake 1 — Forgetting DESC
If you want the highest salary first:
Mistake 2 — Wrong column
Make sure the column used for sorting actually represents what you want to analyze.
Mistake 3 — Incorrect multiple-column ordering
If you want both descending:
Mistake 4 — Confusing WHERE and ORDER BY
WHERE filters rows. ORDER BY sorts rows. They perform different jobs.
🔹 Interview Questions
1. What is ORDER BY?
ORDER BY sorts query results based on one or more columns.
2. What is the default sorting order?
Ascending order (ASC) is generally the default.
3. How do you find the highest salary?
4. Can you sort using multiple columns?
Yes.
5. What is the difference between ASC and DESC?
ASC sorts from low to high or A–Z. DESC sorts from high to low or Z–A.
🎯 Practice Questions
1. Write a query to display all products from the cheapest to the most expensive.
2. Write a query to display employees from the highest salary to the lowest salary.
3. Write a query to display customers alphabetically by name.
4. Write a query to sort sales by date, showing the newest sales first.
5. Write a query to sort employees by department alphabetically and salary from highest to lowest within each department.
🎯 Key Takeaways
• ORDER BY sorts query results
• ASC means ascending
• DESC means descending
• Ascending is generally the default
• You can sort numbers, text and dates
• You can sort using multiple columns
• WHERE filters data; ORDER BY sorts data
• ORDER BY is especially useful when analyzing rankings and top/bottom records
👉 Double Tap ❤️ For More
Suppose you are analyzing sales data. You want to identify the highest-value transactions.
SELECT customer_id, product_id, quantity, price,
quantity * price AS transaction_value
FROM sales
ORDER BY transaction_value DESC;
This can help with:
• Finding high-value transactions
• Identifying important customers
• Investigating unusually large purchases
• Preparing data for further analysis
🔹 Common Mistakes
Mistake 1 — Forgetting DESC
If you want the highest salary first:
ORDER BY salary DESC; Not ORDER BY salary;Mistake 2 — Wrong column
Make sure the column used for sorting actually represents what you want to analyze.
Mistake 3 — Incorrect multiple-column ordering
ORDER BY department, salary DESC; does NOT mean both columns are descending. It means: department → ASC, salary → DESCIf you want both descending:
ORDER BY department DESC, salary DESC;Mistake 4 — Confusing WHERE and ORDER BY
WHERE filters rows. ORDER BY sorts rows. They perform different jobs.
🔹 Interview Questions
1. What is ORDER BY?
ORDER BY sorts query results based on one or more columns.
2. What is the default sorting order?
Ascending order (ASC) is generally the default.
3. How do you find the highest salary?
SELECT * FROM employees ORDER BY salary DESC;
4. Can you sort using multiple columns?
Yes.
ORDER BY department ASC, salary DESC;5. What is the difference between ASC and DESC?
ASC sorts from low to high or A–Z. DESC sorts from high to low or Z–A.
🎯 Practice Questions
1. Write a query to display all products from the cheapest to the most expensive.
2. Write a query to display employees from the highest salary to the lowest salary.
3. Write a query to display customers alphabetically by name.
4. Write a query to sort sales by date, showing the newest sales first.
5. Write a query to sort employees by department alphabetically and salary from highest to lowest within each department.
🎯 Key Takeaways
• ORDER BY sorts query results
• ASC means ascending
• DESC means descending
• Ascending is generally the default
• You can sort numbers, text and dates
• You can sort using multiple columns
• WHERE filters data; ORDER BY sorts data
• ORDER BY is especially useful when analyzing rankings and top/bottom records
👉 Double Tap ❤️ For More
❤2