Results 1 to 8 of 8

Thread: How many records in output

  1. #1
    Geek_Guest
    Guest

    How many records in output

    Two table 1) dept 2) emp both table having the following values.

    deptid dept_name
    100 sales
    200 finance
    300 hr
    400 bbbb

    empid empname deptid salary
    1 a 100 1000
    2 b 100 2000
    3 c 200 1000
    4 d 200 2500
    5 e 200 1000
    6 f 300 2000

    the query is

    select deptname
    from dept a, emp b
    where b.deptid=a.deptid(+)
    group by a.deptname
    having count(deptname)>=1

    my question is the ouput of this query is how many records?

    Question asked by visitor indiradharmaraj


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: How many records in output

    How many you are getting ?


  3. #3
    Junior Member
    Join Date
    Oct 2007
    Answers
    1

    Re: How many records in output

    It should be 6 I believe.


  4. #4

    Re: How many records in output

    6 records will be retrieved. In this query outer join is used and there are six records where the dept id in both the tables are same, and the having clause says that only where the count of department is greater or equal to one.


  5. #5
    Junior Member
    Join Date
    Oct 2007
    Answers
    3

    Re: How many records in output

    hi

    u will get four records in the output


  6. #6

    Re: How many records in output

    there will be six records in the output.


  7. #7
    Junior Member
    Join Date
    Nov 2007
    Answers
    2

    Re: How many records in output

    The output will be 3 records as we are grouping by Dept Name


  8. #8
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: How many records in output

    3 Records in output
    Deptname
    Finance
    Hr
    Sales


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