He has done wrong is First Quiry, Why he mentioned Sum? Q. Just filter the category other then tobacoo exceeded 50L Select category, Sales_amout from Sales WHERE category != 'tobacco' AND sales_amount > 5000000 ORDER BY sales_amount DESC LIMIT 3; Correct me if I am wrong!
First, you need to mention "sum" because there is no total sales amount in the given table. Second, you are taking "category" with an aggregate function "sum", so you should use group by. Third, you cannot use aggregate functions such as sum with where clause so sum(total_price) > 5000000 has to be used in having. so, the query will look like this- SELECT category, SUM(price) AS total_sales FROM sales WHERE category != 'Tobacco' GROUP BY category HAVING SUM(price) > 500000 ORDER BY SUM(price) DESC LIMIT 3
@@WhatshappeningUf You said "correct me if I am wrong." So I did. It is not about perspective. It is the answer to the question. Look at the table, the columns, and the question, you will get it. Also, to confirm, I ran the query and got the answer. You answer is correct if there is a table with sales amount for each category. This is different.
i have never seen such a timepass person like him he was literally passing the time and wasting others time.
Can you make a video of advanced SQL interview questions as well?
Good job Aditya !!😊
This is so good thanks for sharing
Can you share all the dataset uses in this video
Sure we will share, please text us @7205617787
Could you please share the feedback if possible, did this person got selected ?
Is it possible for me to get a chance of getting interviewed I really want to test my skills that I have learnt
Pls send your profile to info@talentele.in
I have sent the details
He has done wrong is First Quiry, Why he mentioned Sum? Q. Just filter the category other then tobacoo exceeded 50L
Select category, Sales_amout
from Sales
WHERE category != 'tobacco'
AND sales_amount > 5000000
ORDER BY sales_amount DESC
LIMIT 3;
Correct me if I am wrong!
I too would like to know. I am still learning SQL and think your answer is appropriate. Sum gives total but not individual top 3 sales.
First, you need to mention "sum" because there is no total sales amount in the given table.
Second, you are taking "category" with an aggregate function "sum", so you should use group by.
Third, you cannot use aggregate functions such as sum with where clause so sum(total_price) > 5000000 has to be used in having.
so, the query will look like this-
SELECT category, SUM(price) AS total_sales
FROM sales
WHERE category != 'Tobacco'
GROUP BY category
HAVING SUM(price) > 500000
ORDER BY SUM(price) DESC
LIMIT 3
@@aish000 may be your answer is correct on your perspective. My suggestion is you have to check the Question
@@WhatshappeningUf You said "correct me if I am wrong." So I did. It is not about perspective. It is the answer to the question. Look at the table, the columns, and the question, you will get it. Also, to confirm, I ran the query and got the answer. You answer is correct if there is a table with sales amount for each category. This is different.
@@aish000 that’s cool, appreciate
we can't rollback if we are using auto-commit
Exactly what I was thinking. After the changes are committed, you need to retrieve the deleted data from the backup.
is this for experience or for fresher?
Freshers questions.
SELELCT CATEGORY ,SUM(TOTAL_PRICE) FROM DATA WHERE CATEGORY != "TABACO" GROUP BY CATEGORY HAVING TOTTAL_PRICE >50000 LIMIT 3
its so disrespectful that you have to write on a video call, I am here in Europe they hardly do this. like write the code in front of you
here in india in every interview you have to do this otherwise they wont consider you no matter what.