Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Table are as follows:

Emp: empid,age ,empname

Dept: depid, depname,empid

[edit]SHOUTING removed - OriginalGriff[/edit]
Posted
Updated 7-Nov-14 22:55pm
v2
Comments
OriginalGriff 8-Nov-14 4:55am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalization if you want to be taken seriously.

1) We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

2) As I said: DON'T SHOUT. Even if I was inclined to help you, I wouldn't have - because you started the conversation by being deliberately rude.
 
Share this answer
 
read :
SQL GROUP BY Statement[^]
SQL MAX() Function[^]
SQL INNER JOIN [^]

sample sql query (I assume you have salary in emp table)
SQL
SELECT MAX(E.SALARY), D.DEPNAME FROM EMP E
JOIN DEPT D ON E.EMPID = D.EMPID
GROUP BY D.DEPNAME
 
Share this answer
 
v2
Comments
Manas Bhardwaj 8-Nov-14 7:41am    
Will do. +5
DamithSL 8-Nov-14 7:55am    
Thank you, Manas
What have you tried so far?

And looking at the Table structure, I don't even find the salary column itself. So, how do you know what the Salary is.

The current table structure is not even normalised.
Anyway, if I were you I would first restructure the tables as:

SQL
Employee:
	Id,
	Name,
	Age,
	Salary,
	DepartmentId


SQL
Department:
	Id,
	Name


Apart from that I would suggest you to look at following topics (atleast) in SQL:

MAX

http://www.w3schools.com/sql/sql_join.asp[^]

GroupBy

http://www.w3schools.com/sql/sql_groupby.asp[^]

Joins

http://www.w3schools.com/sql/sql_join.asp[^]

I suggest you try it out writing yourself and show us what have you tried. And if you still have questions, someone here would help you.
 
Share this answer
 
Comments
DamithSL 8-Nov-14 7:57am    
5wd!
Manas Bhardwaj 8-Nov-14 8:17am    
thx ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900