SQL HAVING - Overview, syntax

          

SQL HAVING - Overview, syntax


SQL HAVING - Introduction and syntax

<<Previous  Next>>

SQL - Dec 03, 2008 at 18:00 PM by Rajmeet Ghai

Explain the SQL HAVING statement. Write SQL syntax for the SQL HAVING statement along with an example.

HAVING clause is used to specify some condition along with aggregate functions.

Syntax:
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value

Example:
SELECT emp_id,SUM(salary) FROM employee
WHERE employee_name='tom’
GROUP BY emp_id
HAVING SUM(salary)>1500


Explain the SQL UNION ALL statement. Write SQL syntax for the SQL UNION ALL statement along with an example.

SQL UNION ALL: The UNION ALL operator is used to combine the result-set of two or more SELECT statements Tables of both the select statement ................

SELECT DISTINCT

SELECT DISTINCT: It is used to select unique records from a table. Some tables may have duplicate values for a column. Distinct will eliminate these duplications...........

SQL GROUP BY

GROUP BY: It is used with aggregate functions to group the result-set by one or more columns................

SQL CREATE VIEW

SQL CREATE VIEW: A view is a virtual table. A view contains rows and columns, just like a real table..............

SQL CONCATENATE

SQL CONCATENATE: This clause combine together (concatenate) the results from several different fields...............

SQL BETWEEN

SQL BETWEEN: The BETWEEN operator is used in a WHERE clause to select a range of data between two values. The values can be numbers, text, or dates..............

<<Previous  Next>>



Write your comment - Share Knowledge and Experience


 
Latest placement tests
Latest links
 
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring