My second post in quick succession.Trying to solve some database questions that I downloaded from the internet.
SQL> select * from aircraft;
AID ANAME CRANGE
---------- -------------------- ----------
1 Boeing 1000
2 Indigo 2000
3 Spice 3000
SQL> select * from certified;
AID EID
---------- ----------
1 1
1 2
2 3
2 4
3 5
SQL> select * from employee;
EID ENAME SALARY
---------- ---------- ----------
1 Ram 10000
2 SRam 10400
3 DRam 15400
4 SDRam 15400
5 DDRam 19900
Query:For all aircrafts with crange>1000 find the NAME OF THE AIRCRAFT and the AVERAGE SALARY of pilots certified to operate the aircraft.
SQL> select avg(salary) from employee group by (eid) having eid in(select aid fr
om certified group by aid having aid in(select aid from aircraft where crange>10
00));
AVG(SALARY)
-----------
10400
15400
Questions:
I think I have written a part of the query correctly but shouldn't the answer be 15400 and 19900?
How do I display the names of the aircrafts.I have tried using aircraft.aname but an "invalid identifier error is thrown".Please help.
Thank you in advance

New Topic/Question
Reply


MultiQuote





|