0% found this document useful (0 votes)
8 views2 pages

Joins in SQL

Uploaded by

mohimambbs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Joins in SQL

Uploaded by

mohimambbs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Grouping records,joins in sql

1. What are aggregate functions? What is their use? Give some examples.

The function that work on whole records of one column at a time is called aggregate
functions Or in other word Function that works on aggregate of rows. A multiple row
function.

Uses:-An aggregate Function retrieve a single value after performing calculation on set of
values

Example :-

SUM (),MIN(),MAX(),COUNT(),AVG() etc.

2. What are different types of SQL functions?

(i) Single Row (or Scalar) functions.

(ii) Multiple Row (or Group or Aggregate) functions.

--- (i) Single Row Functions work with a single row at a time. A single row function returns a

result for every row of a queried table.

--- (ii) Multiple Row or Group Functions work with data of multiple rows at a time and return

aggregated value.

3. What is the significance of GROUP BY clause in a SQL query?

The GROUP BY clause combines all those records that have identical values in a particular

field or a group of fields. This grouping results into one summary record per group if

group-functions are used with it.

4. What type of functions can you use with GROUP BY and HAVING clauses?

Aggregate Function can we use with GROUP BY and HAVING clauses.

5. What is the difference between a WHERE clause and a HAVING clause of SQL SELECT
statement?

The difference between WHERE and HAVING clause is that WHERE conditions are applicable
on individual rows whereas HAVING conditions are applicable on groups as formed by
GROUP BY clause.

The HAVING clause places conditions on groups in contrast to WHERE clause that places
conditions on individual rows. While WHERE conditions cannot include aggregate functions,
HAVING conditions can include aggregate functions. Hence, WHERE and HAVING clauses
cannot be used interchangeably in SELECT queries.

6. What are JOINS?

A JOIN is a query that combines tuples from more than one table. In a join query, the table
names are given with FROM clause, separated by a comma.

For example,

SELECT name, salary FROM emp1, emp2;

In this statement, the two tables are emp1 and emp2 from which the column name and
salary are extracted.

You might also like