RUVIDEO
Поделитесь видео 🙏

SQL Tutorial 6, Select with Group By and Having plus Where

Learn SQL, Introduction to DML: How to use group by and having in a select statement, using where and having together. Filter grouped data. #sql, #rdbms, #table, #amitchandakda #interviewquestions #interview

Definition Source: Google Search, Wikipedia, IBM, W3School

00:00 Introduction
03:00 Group By
12:00 Group By with Having

Last Video: SQL Tutorial 4- Where Clause, Copy Table, Import Data: https://youtu.be/4vAesfpoGfM

Code
select *
from sales
where Item_ID in
(select item_id
from item
where Brand = 'Brand 1'
) ;


select *
from sales
where City_Id in
(select City_Id
from geography
where State = 'New York'
) ;


select s.*
from Sales as s
inner join
(select City_Id
from geography
where State = 'New York'
) g on g.City_Id = s.City_Id ;


select s.*
from sales s ,
(select item_id
from item
where Brand = 'Brand 1'
) i
where i.Item_ID = s.item_id
;


select s.*
from sales s ,
item i
where i.Item_ID = s.item_id
and Brand = 'Brand 1';


select Brand, count(Distinct Category) cat_cnt
from item i
where Category in ('Category 1', 'Category 2')
group by Brand
having count(Distinct Category) =2;


select s.*
from sales s
inner join item i
on i.Item_Id = s.Item_ID
where brand in
(select Brand
from item i
where Category in ('Category 1', 'Category 2')
group by Brand
having count(Distinct Category) =2)


select s.*
from sales s
inner join item i
on i.Item_Id = s.Item_ID
where Category in ('Category 1', 'Category 2') ;



select s.*
from sales s
inner join item i
on i.Item_Id = s.Item_ID
inner join (select Brand
from item i
where Category in ('Category 1', 'Category 2')
group by Brand
having count(Distinct Category) =2) b
on i.Brand = b.Brand;



select item_id
from item
where Brand in (select Brand
from item i
where Category in ('Category 1', 'Category 2')
group by Brand
having count(Distinct Category) =2)


select s.*
from sales as s
inner join ( select item_id
from item
where Brand in (select Brand
from item i
where Category in ('Category 1', 'Category 2')
group by Brand
having count(Distinct Category) =2) ) i
on i.Item_Id = s.Item_ID


select *
from sales s
left join (select * from item where item_id LT= 50) i
on i.Item_Id = s.item_id



select *
from ( select * from sales s where item_id GT 10) s
right join item i
on i.Item_Id = s.item_id ;


select *
from ( select * from sales s where item_id GT 10) s
full join (select * from item where item_id LT= 50) i
on i.Item_Id = s.item_id

-~-~~-~~~-~~-~-
Please watch: "Microsoft Power BI Tutorial For Beginners✨ | Power BI Full Course 2023 | Learn Power BI"
https://www.youtube.com/watch?v=cN8AO3_vmlY
-~-~~-~~~-~~-~-

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «SQL Tutorial 6, Select with Group By and Having plus Where», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.