ВУЗ:
Составители:
Рубрика:
153
Select discounts/stor_id, discounts.discounttype, stores.stor_name
From discounts INEER JOIN stores
ON discounts.stor_id = stores.stor_id
-- этот запрос эффективнее предшествующего.
Select discounts.stor_id, discounts.discounttype, stores.stor_name
From discounts, stores
Where discounts.stor_id, *= stores.stor_id --3 строки
-- это - аналог LEFT OUTER JOIN:
Select discounts.stor_id, discounts.disconttype, stores.stor_name
From discounts LEFT OUTER JOIN stores
ON discounts.stor_id = stores.stor_id --3 строки
Select discounts.stor_id, discounts.discounttype, stores.stor_name
Where discounts.stor_id =* stores.stor_id
-- это - аналог RIGHT OUTER JOIN
Select discounts.stor_id, discounts.discounttype, stores.stor_name
From discounts RIGHT OUTER JOIN stores
ON discounts.stor_id = stores.stor_id --6 строк
U)Использование разделов GROUP BY и HAVING:
Select type, SUM(price), COUNT(*)
From titles -- type-тип изданий
Group By type --6 строк
-- выдается колонка type, колонка SUM и счетчик COUNT
Select type, SUM(price), count = COUNT(*) -- имя столбца
Form titles
Where type < 'ps'
Group BY type --3 строки
Select type, SUM(price), count = COUNT(*) -- имя счетчика count
From titles
Where type < 'ps'
Group By ALL type --6 строк
-- строки с type >= 'ps'- без агрегирования
Select type, pub_id, SUM(price), COUNT(*)
From titles
Where price <> 0
Group By type, pub_id --7 агрегированных строк
Select type, pub_id, SUM(price), COUNT(*)
From titles
Where price <> 0
Group By type, pub_id With Cube --суперагрегирование
Select type, pub_id, SUM(price), COUNT(*)
Select discounts/stor_id, discounts.discounttype, stores.stor_name
From discounts INEER JOIN stores
ON discounts.stor_id = stores.stor_id
-- этот запрос эффективнее предшествующего.
Select discounts.stor_id, discounts.discounttype, stores.stor_name
From discounts, stores
Where discounts.stor_id, *= stores.stor_id --3 строки
-- это - аналог LEFT OUTER JOIN:
Select discounts.stor_id, discounts.disconttype, stores.stor_name
From discounts LEFT OUTER JOIN stores
ON discounts.stor_id = stores.stor_id --3 строки
Select discounts.stor_id, discounts.discounttype, stores.stor_name
Where discounts.stor_id =* stores.stor_id
-- это - аналог RIGHT OUTER JOIN
Select discounts.stor_id, discounts.discounttype, stores.stor_name
From discounts RIGHT OUTER JOIN stores
ON discounts.stor_id = stores.stor_id --6 строк
U)Использование разделов GROUP BY и HAVING:
Select type, SUM(price), COUNT(*)
From titles -- type-тип изданий
Group By type --6 строк
-- выдается колонка type, колонка SUM и счетчик COUNT
Select type, SUM(price), count = COUNT(*) -- имя столбца
Form titles
Where type < 'ps'
Group BY type --3 строки
Select type, SUM(price), count = COUNT(*) -- имя счетчика count
From titles
Where type < 'ps'
Group By ALL type --6 строк
-- строки с type >= 'ps'- без агрегирования
Select type, pub_id, SUM(price), COUNT(*)
From titles
Where price <> 0
Group By type, pub_id --7 агрегированных строк
Select type, pub_id, SUM(price), COUNT(*)
From titles
Where price <> 0
Group By type, pub_id With Cube --суперагрегирование
Select type, pub_id, SUM(price), COUNT(*)
153
Страницы
- « первая
- ‹ предыдущая
- …
- 151
- 152
- 153
- 154
- 155
- …
- следующая ›
- последняя »
