Select Statement
It is used to retrieve a set of data from a database.
Select Distinct Statement
It is used to retrieve a set of data from a database without contains duplicate values.
Where Clause
It is used to extract only those records that fulfill a specified criterion. It could not be used with aggregate functions.
Order By Keyword
It is used to sort the result-set by a specified column in ascending(ASC) order or descending(DESC) order.
Group By Clause
It is used in conjunction with the aggregate functions to group the result-set by one or more columns.
Having Clause
It is used with aggregate functions.
It is used to retrieve a set of data from a database.
SELECT column_name
FROM table_name
FROM table_name
Select Distinct Statement
It is used to retrieve a set of data from a database without contains duplicate values.
SELECT DISTINCT column_name
FROM table_name
FROM table_name
Where Clause
It is used to extract only those records that fulfill a specified criterion. It could not be used with aggregate functions.
SELECT column_name
FROM table_name
WHERE expression
FROM table_name
WHERE expression
Order By Keyword
It is used to sort the result-set by a specified column in ascending(ASC) order or descending(DESC) order.
SELECT column_name
FROM table_name
WHERE expression
ORDER BY column_name ASC
FROM table_name
WHERE expression
ORDER BY column_name ASC
Group By Clause
It is used in conjunction with the aggregate functions to group the result-set by one or more columns.
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE expression
GROUP BY column_name
FROM table_name
WHERE expression
GROUP BY column_name
Having Clause
It is used with aggregate functions.
SELECT column_name, aggregate_function(column_name)
FROM table_name
GROUP BY column_name
HAVING aggregate_function(column_name) operator value
Example:
SELECT column_name1,SUM(column_name2)
FROM table_name
WHERE expression
GROUP BY column_name1
HAVING SUM(column_name2)< 2000
FROM table_name
GROUP BY column_name
HAVING aggregate_function(column_name) operator value
Example:
SELECT column_name1,SUM(column_name2)
FROM table_name
WHERE expression
GROUP BY column_name1
HAVING SUM(column_name2)< 2000
0 comments:
Post a Comment