If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Sql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-10-02, 10:52
robert123 robert123 is offline
Registered User
 
Join Date: Apr 2002
Posts: 6
Sql

Let me know the answer?
Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) DEPARTMENT_ID NUMBER SALARY NUMBER
What is the correct syntax for an inline view?

A.
SELECT a.last_name, a.salary, a.department_id, b.maxsalFROM employees a, (SELECT department_id, max(salary)maxsal FROM employees GROUP BY department_id) bWHERE a.department_id = b.department_id AND a.salary < b.maxsal;

B.
SELECT a.last_name, a.salary, a.department_idFROM employees a WHERE a.department_id IN (SELECT department_id FROM employees b GROUP BY department_id having salary = (SELECT max(salary) from employees c));

C.
SELECT a.last_name, a.salary, a.department_idFROM employees a WHERE a.salary = (SELECT max(salary) FROM employees b WHERE a.department_id = b.department_id);

D.
SELECT a.last_name, a.salary, a.department_idFROM employees a WHERE (a.department_id, a.salary) IN (SELECT department_id max(salary) FROM employees b GROUP BY department_id ORDER BY department_id);
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On