Results 1 to 4 of 4

Thread: Subquery

  1. #1
    Join Date
    May 2013
    Posts
    33

    Unanswered: Subquery

    Code:
    SQL> SELECT * from depT;
    
        DEPTID      EMPID    CLASSID ENROLLEDO      GRADE
    ---------- ---------- ---------- --------- ----------
             1          1          1 23-SEP-02         62
             2          1          2 30-SEP-02         70
             3          2          3 23-SEP-03         51
             4          2          5 23-SEP-03         41
             5          2          6 23-SEP-03         68
             6          3          4 30-SEP-02         78
             7          3          7 30-SEP-02         80
             8          4          8 20-SEP-02         70
    
    8 rows selected.
    Code:
    SQL> SELECT * from empexam;
    
         EMPID     EXAMID       MARK      TAKEN COMMENTS
    ---------- ---------- ---------- ---------- -------------
             1          1         55          1 Satisfactory
             1          2         73          1 Good result
             2          3         44          1 Hard
             2          5         39          0 Simple
             2          6         63          1
    what will be the output for this subquery?

    Code:
    SQL> SELECT empID, Grade FROM dept e
      2      WHERE Grade > ALL (
      3         SELECT Mark FROM empExam s
      4         WHERE s.empID = e.empID);

  2. #2
    Join Date
    Jun 2004
    Posts
    796
    Provided Answers: 1
    what will be the output for this subquery?
    What output do you get?
    90% of users' problems can be resolved by punching them - the other 10% by switching off their PCs.

  3. #3
    Join Date
    May 2013
    Posts
    33
    I am getting this as a output ? Is it right?
    Code:
         EMPID      GRADE
    ---------- ----------
             2         68
             3         78
             3         80
             4         70

  4. #4
    Join Date
    Jun 2004
    Posts
    796
    Provided Answers: 1
    Is it right?
    Is the output what you were expecting? If so, then the query is right.
    Were you hoping for different output? If so, then you need to change the query accordingly.
    90% of users' problems can be resolved by punching them - the other 10% by switching off their PCs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •