SQL GROUP BY - Introduction and syntax
Explain the SQL GROUP BY statement. Write SQL syntax for the SQL GROUP BY
statement along with an example.
GROUP BY: It is used with aggregate functions to group the
result-set by one or more columns.
Syntax:
SELECT column_name, aggregate_function(column_name) FROM table_name
WHERE column_name operator value GROUP BY column_name
Example:
SELECT Emp_id,joiningdt,SUM(salary) FROM employee GROUP BY
emp_id,joiningdt
SQL CONCATENATE: This clause combine together (concatenate) the results from
several different fields...............
SQL EXISTS: If the subquery returns at least one row the EXISTS condition is
considered "to be met"...............
SQL SELECT INTO: The SELECT INTO statement selects data from one table and
inserts it into a different table. Used often for creating back
up’s............
WHERE: It is used to fetch records that fulfill a specified
condition.................
SQL UNION: The UNION operator is used to combine the result-set of two or more
SELECT statements Tables of both the select statement................
|