You are on page 1of 1

3.

SELECT column_name(s) FROM table_name WHERE condition


GROUP BY column_name(s) ORDER BY column_name(s);
SELECT COUNT(CustomerID), Country FROM Customers GROUP BY Country
ORDER BY COUNT(CustomerID) DESC;

5. An aggregate function in SQL performs a calculation on multiple values and


returns a single value. SQL provides many aggregate functions that include avg,
count, sum, min, max, etc. An aggregate function ignores NULL values when it
performs the calculation, except for the count function.

6. Inner joins combine records from two tables whenever there are matching
values in a field common to both tables. You can use INNER JOIN with the
Departments and Employees tables to select all the employees in each department.

7. LEFT (OUTER) JOIN : Returns all records from the left table, and the matched
records from the right table. RIGHT (OUTER) JOIN : Returns all records from the
right table, and the matched records from the left table. FULL (OUTER) JOIN :
Returns all records when there is a match in either left or right table.

8. The CROSS JOIN query in SQL is used to generate all combinations of records
in two tables. For example, you have two columns: size and color, and you need a
result set to display all the possible paired combinations of those—that's where the
CROSS JOIN will come in handy.

You might also like