What is
Group by Clause ? Explain with an
example.
Answers
ʜᴇʟʟᴏ..!!
The GROUP BY clause is a SQL command that is used to group rows that have the same values. The GROUP BY clause is used in the SELECT statement. Optionally it is used in conjunction with aggregate functions to produce summary reports from the database. That's what it does, summarizing data from the database.
ᴛʜᴀɴᴋ ʏᴏᴜ♡
Answer:
it is simple
Explanation:
it used to summarize the columns of same data and display the output...now this sounds, confusing let me give you an example
let say we have a table named employee_data with columns as
(sno, name, country, phone)
it is filled with lots of data. now you are asked to show how many people are of particular countries
example:
sno name country phone
1 A India 98
2 B USA 32
3 C India 86
4 D France 45
so we use a statement in database as :
select count(*), country from employee_data group by country;
so output will look like this
India 2
USA 1
France 1
hope it helps you understanding the concept