Results 1 to 3 of 3

Thread: Writeing a query with HAVING clause

  1. #1
    Expert Member
    Join Date
    Oct 2006
    Answers
    209

    Writeing a query with HAVING clause

    how can I write HAVING query! can please lem me know thanks.


    NOTE : [This question was asked by patel]


  2. #2
    Expert Member
    Join Date
    Dec 2006
    Answers
    139

    Re: Writeing a query with HAVING clause

    Hi Patel,

    Go to quick links, click on private messages,click on new messages.Post ur query it will automatically come on forum.


    I hope your query solve.Plz revert me with feed back or any further query.


    Thanks & Regards

    Nikhil Rattan


  3. #3
    Expert Member
    Join Date
    Sep 2006
    Answers
    130

    Re: Writeing a query with HAVING clause

    Hi Patel,
    The HAVING clause is used in combination with the GROUP BY clause. It can be used in a SELECT statement to filter the records that a GROUP BY returns.
    HAVING clause is used with aggregate_function like SUM, COUNT, MIN, or MAX.

    Let me give an HAVING clause example with COUNT function.

    SELECT dept_no, COUNT(*)
    FROM employees
    WHERE salary > 25000
    GROUP BY dept_no
    HAVING COUNT(*) > 10;

    This example will select the No. of employees of all deptartments with salary greater than 25000. Here the HAVING clause filters the records with departments which have more than 10 employees.

    Similarly other aggregate functions can be used.

    Hope its clear :-)


    *** Mangai Varma ***


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact