Загрузка...

HAVING Clause in MySQL|| MySQL Tutorial || Code With Neha

In one of my previous video of mysql series I have discussed about group by clause today I am here to discuss about having clause

The MySQL HAVING Clause

The HAVING clause was added to SQL because the WHERE keyword cannot be used with aggregate functions.

HAVING Syntax

SELECT column_name(s)
FROM table_name
WHERE condition
GROUP BY column_name(s)
HAVING condition
ORDER BY column_name(s);
Today I am using customers table under customers _C1 database

Query to list the number of customers in each country only include countries with more than 5 customers
Select count (CustomerId), Country
From customers
Group by country
Having count(CustomerId) more than 5

The result shows null as there are no datas which can satisfy this query

Moving to the 2nd query that is
Query to list the number of customers in each country only include countries with less than 2 customers

Select count (CustomerId), Country
From customers
Group by country
Having count(CustomerId) less than 2

To arrange the query in descending order with respect to country

Select count (CustomerId), Country
From customers
Group by country
Having count(CustomerId) less than 2
ORDER BY Country

that's all for today Hope you all will get some help from this video
If it's so then don't forget to subscribe my channel Code with Neha and press the Bell Icon for Regular Updates
See you in the next video till then Stay Safe Stay Happy
#havingclauseinmysql
#groupbyhavingclauseinmysql
#howtousehavingclauseinmysql
#differencebetweenwhereandhavingclauseinmysql
#havingclauseandgroupbyclause
#havingclauseinsql
#havingclauseindbms
#groupbyclause
#groupbyclauseinsql
#groupbyclauseinmysql
#mysqlgroupbyclause
#useofgroupbyclauseinmysql
#clausesinsql
#whatisgroupbyinsqlquery?
#groupbyinsqlwithwherecondition
#examplesofgroupbyclause
#examplesofgroupbyclauseinmysql
#sqltutorialsforbeginners
#sqlgroupbytutorial
#sqlgroupbyexamples
#groupbyinsql
#groupbyinmysql
#mysqlgroupby
#groupbystatementinmysql
#learnmysql
#mysqltutorial
#mysqldatabase
#mysqlcourse
#mysqldatabasetutorial
#mysqlcrashcourse
#mysqltutorialforbeginners
#sqlforbeginners
#groupbyclausesyntax
#sqlgroupby
#sqltutorial
#sqltutorialforbeginners
#mysqltutorial
#mysqltutorialforbeginners
#mysql
#mysqldatabase
#coding
having clause in mysql, group by having clause in mysql, how to use having clause in mysql, difference between where and having clause in mysql, having clause and group by clause, having clause in sql, having clause in dbms, group by clause, group by clause in MySQL, group by clause in mysql, group by clause in sql, mysql tutorial, mysql group by clause, mysql having clause

Видео HAVING Clause in MySQL|| MySQL Tutorial || Code With Neha канала Code With Neha
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять