Having standart so‘zi orqali so‘rovlar yaratish
Download 25.28 Kb.
|
etgfe
HAVING standart so‘zi orqali so‘rovlar yaratish. HAVING operatori GROUP BY operatori bilan birgalikda guruhlar uchun asosan agregat funksiya natijalariga shart berish orqali cheklovlar o’rnatish uchun ishlatiladi. HAVING operatori sintaksisi quyidagicha: SELECT select_list FROM table_name WHERE search_condition GROUP BY group_by_expression HAVING group_condition; Bu sintaksisda GROUP BY orqali hosil qilngan satrlar, group_condition o’rnida berilgan shart rost qiymat qabul qilganda natijaviy jadvalga kiritiladi. HAVING operatori bajarilish tartibi: SELECT product, SUM(quantity) AS "Total quantity" FROM order_details GROUP BY product HAVING SUM(quantity) > 10; SELECT
SUM(quantityOrdered) AS itemsCount, SUM(priceeach*quantityOrdered) AS total FROM orderdetails GROUP BY ordernumber HAVING total > 1000; SELECT
SUM(quantityOrdered) AS itemsCount, SUM(priceeach*quantityOrdered) AS total FROM orderdetails GROUP BY ordernumber HAVING total > 1000 AND itemsCount > 600; Download 25.28 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling