SQL Tutorial - Nesting CASE statements

SQL Tutorial - Nesting CASE statements

BeardedDev

2 года назад

19,245 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@BeardedDevData
@BeardedDevData - 13.06.2022 12:13

Can you think of a more elegant solution?

Ответить
@kummithavenkatareddy2302
@kummithavenkatareddy2302 - 11.01.2024 08:38

Why we need to give columns in Group by clause which are using case statements?
Select
c1,
c2='x' sum(values in c3) sum(values in c4) end as 'z'
from table A
where c5='Y' and c6='w'
group by c1, ( Do we need to use c2 here )


c1, Z column (I need Z values grouped by only c1 column )

Ответить
@NAVINSUTTLE
@NAVINSUTTLE - 06.10.2023 14:28

good video, but not able to clearly hear.

Ответить
@oraclesql
@oraclesql - 17.09.2023 21:39

Well done on hitting 1 million total views Bearded Dev. Your channel is pure gold and I wish you were still putting up content

Ответить
@ramona3075
@ramona3075 - 17.06.2023 04:34

Thank you so much bro

Ответить
@yaseersayeed1215
@yaseersayeed1215 - 24.04.2023 18:39

Hi solution and explanation are awesome, need more case with respect to system time concat statement and many more thanks in advance but it's required for further improvement in this case statement.

Ответить
@kennisrogers2585
@kennisrogers2585 - 31.01.2023 19:20

This was very helpful! Thank you.

Ответить
@uttambongarde6558
@uttambongarde6558 - 27.08.2022 18:54

In my case statement they provide the conditions for the columns but we need to fetch the values from that column.
E.g. CASE When ABC.(Tbl n).Contact desc= 'phonenumber'.
I want here phonenumbers for different IDs.
How to do this??

Ответить
@referralhelper
@referralhelper - 15.07.2022 16:23

Great job with real world problem

Ответить
@srisanthoshk1532
@srisanthoshk1532 - 23.06.2022 20:22

Hi, in all your videos you talk about relational set which is basis for relational databases. So in order completely understand the relational set which math should I learn, so that I completely understand the logic behind any given SQL query? Please advice.

Ответить
@MethodOverRide
@MethodOverRide - 14.06.2022 03:07

On mobile so I cannot elaborate, but this feels like it could benefit from a stored procedure to calculate the discount. I'm thinking about calling a proc in the case statement and feed it the parameters for the different discounts.

WHEN CustomerType
THEN EXEC dbo.CalculateDiscount(...)
END AS Discount

Ответить