473,395 Members | 1,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

please help me to solve the query

Hello everybody,

I want Create a loop that will display the average salary by department id from the employees table. please help me. The employee table is as under.

EMPLOYEE_ID DEPARTMENT_ID SALARY
100 90 24000
101 90 17000
102 90 17000
103 60 9000
104 60 6000
107 60 4200
124 50 5800
141 50 3500
142 50 3100
143 50 2600
144 50 2500
149 80 10500
174 80 11000
176 80 8600


Thank you
Deven Oza
Dec 9 '06 #1
2 1090
michaelb
534 Expert 512MB
This might work for you:

select DEPARTMENT_ID, avg(SALARY) from employees group by DEPARTMENT_ID;
Dec 9 '06 #2
This might work for you:

select DEPARTMENT_ID, avg(SALARY) from employees group by DEPARTMENT_ID;

Thank you michael

But I want to solve that query using LOOP, thats why I am confuse. Please try for me.

thank you once again
Dev
Dec 10 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
8
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
3
by: MattB | last post by:
Not sure if this is a good approach or not, but I'd like to hear some informed opinions. I've designed an ECommerce site that interfaces with my company's POS system. I'm trying to make it as...
5
by: Darin L. Miller | last post by:
I'm not too good with advanced SQL queries, so please bear with me on this. I have a query with multiple joins that I am trying to get just the last 10 of each unique record (RecordID)...
1
by: arun | last post by:
Query is too complex -------------------------------------------------------------------------------- Hi, I was trying to solve this problem since last two days but couldn't find any solution. ...
4
by: Tonio Tanzi | last post by:
I have the following problem in a Win 2000 Server + SQL Server 2000 environment and I hope somewhat can help me to resolve it (after many days of useless attempts I am desperate). In my database...
12
by: ashokingroups | last post by:
Hi, Good morning to all, :-) One interviewer asked me the following question He has given the following two tables including data. DEPT TABLE ------------------- DEPT(DEPTNO, DNAME, LOC)...
2
by: gsreenathreddy | last post by:
Hi! Please solve this query in employee table in scott user i would like view the details of all the employees (empno, ename )who are working under which manager(mgr) .with his manager name...
6
by: fido19 | last post by:
Once upon a time, there lived a chimpanzee called Luycha Bandor (aka Playboy Chimp). Luycha was unhappily married to Bunty Mona, a short but cute little lady chimp. Luycha was tall and handsome –...
0
by: xwebmaster | last post by:
Hi Please help me solving this query.. I have 3 tables.. comm_propDB ID | User_ID | mls_num -----|---------------|--------------------- 2 | 2 | 5004 3 | 2 ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.