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 > nid help in writing a query pls help tnx! :D

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-25-10, 22:27
toinkz toinkz is offline
Registered User
 
Join Date: Jul 2010
Posts: 1
nid help in writing a query pls help tnx! :D

4. Show the following details for any employee who earns a salary greater

than the average for their department. Sort in department number order.

without using top or set.


ename salary deptno
-------------- ----------------- -----------
KING 5000.00 10
JONES 2975.00 20
FORD 3000.00 20
SCOTT 3000.00 20
ALLEN 1600.00 30
BLAKE 2850.00 30

(6 row(s) affected)



In which year did most people join the company? Display the year

and the number of employees.



year no_of_emp
----------- -----------
1984 8

(1 row(s) affected)



Write a query to display an "*" against the row of the most recently

hired employee. Display ename, hiredate and the column maxdate showing "*.


ename hiredate maxdate
------------- ----------- -------
ADAMS Jun 4 1984
ALLEN Aug 15 1983
BLAKE Jun 11 1984
CLARK May 14 1984
FORD Dec 5 1983
JAMES Jul 23 1984 *
JONES Oct 31 1983
KING Jul 9 1984
MARTIN Dec 5 1983
MILLER Nov 21 1983
SCOTT Mar 5 1984
SMITH Jun 13 1983
TURNER Jun 4 1984
WARD Mar 26 1984
Reply With Quote
  #2 (permalink)  
Old 07-25-10, 22:46
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,084
sorry, friend, you came to the wrong site

we won't do your homework for you
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 07-26-10, 04:34
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,002
Want to show us your attempts at answering these? We might be able to point you in the right direction if you show some initiative
__________________
George
Twitter | Blog
Reply With Quote
Reply

Thread Tools
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