You are on page 1of 6

Display the names of those who have done the DAP course.

select pname from studies where course='DAP’


What is the highest number of copies sold by a package?

select title,sold/scost copies from software where sold/scost in (select
max(sold/scost) from software)


Display the names and date of birth of all programmers born in January?

select pname,dob from programmer where


---------- --------NITIN
Display the lowest course fee

select course,ccost from studies where ccost=(select min(ccost) from
studies) group by course,ccost;


How many programmers have done the PGDCA course?

select pname from studies where course='PGDCA';

select count(*) count from studies where course='PGDCA';

Classification: Sensitive

---------. dev_in from software where dev_in='C' group by dev_in 6 REVENUE DEV_IN -------------49000 C Display the details of packages whose sales crossed the 2000 mark? select * from software where scost>2000.'PASCAL').How much revenue has been earned thru the sales of package developed in C? select sum(sold-dcost) revenue.'PASCAL') or prof2 in ('COBOL'.---------.---------SENTHIL POWERPOINT C++ 3000 5000 15000 NITIN VISUALBASIC JAVA 4000 30000 20000 KANDAN EXCEL ACCESS 4000 12000 8000 How many programmers paid 5000 to 10000 for their course? select pname. 9 AVG(CCOST) ---------11444. 10 COUNT ------4 How old is the oldest male programmer? select round(to_char((sysdate-(select min(dob) from programmer where sex='M' ))/365)) age from dual. 7 PNAME TITLE DEV_IN SCOST DCOST SOLD ---------. 8 PNAME COURS -------------SANKAR DAP SIVA DAP TINKU DPA MARTIN DPA TOM MOODY PCP What is the average course fee? select avg(ccost) from studies.-------------------. course from studies where ccost between 5000 and 10000. 11 AGE ---------43 Classification: Sensitive .4444 How many programmers know either COBOL or PASCAL? select count(pname) count from programmer where prof1 in ('COBOL'.-------.

average selling cost and average price per copy select dev_in.---------.Display the sales values of packages developed by each programmer select pname. scost. 12 PNAME SCOST TITLE ---------. scost. avg(dcost).avg(scost).-------------------KANDAN 4000 EXCEL NARAYANAN 2000 IMAGEPROCESSING NITIN 4000 VISUALBASIC RITA 2000 EXCEL SANKAR 1000 WEBPAGE SANKAR 2000 EXCEL SANKAR 2000 WORD PROCESSOR SENTHIL 3000 POWERPOINT SIVA 1000 EXCEL Display number of packages sold by each programmer select pname. 14 15 DEV_IN AVG(DCOST) AVG(SCOST) AVG(SOLD/SCOST) ---------------------------------------ACCESS 8000 3000 4 C 7000 2000 10 C++ 5000 3000 5 HTML 10000 1000 5 JAVA 30000 4000 5 ORACLE 3000 1000 20 Display each programmer’s name. min(dcost) min from software group by pname.(sold/scost) sold from software group by pname. max(dcost) max. title.-------. sold/scost 13 PNAME SOLD ------------------KANDAN 2 NARAYANAN 20 NITIN 5 RITA 6 SANKAR 5 SANKAR 10 SENTHIL 5 SIVA 20 Display each language name with average development cost.---------. title from software group by pname. dev_in.---------KANDAN ACCESS 12000 12000 Classification: Sensitive .avg(sold/scost) from software group by dev_in. costliest and cheapest package developed. select pname. dev_in PNAME DEV_IN MAX MIN ---------.

---------. 18 PNAME TOTAL DCOST TO BE RECOVERED ------------------. sum(scost) TOTAL.2857 Classification: Sensitive . whose dcost has not yet been recovered select pname.66667 C 6000 C++ 2000 HTML 9000 JAVA 26000 ORACLE 2000 Display the total scost. dcost. lowest and average salaries for those earning more than 2000 select max(salary) max. 19 MAX MIN AVG ---------.---------30000 15000 20714. select count(pname). dcost and the amount to be recovered for each programmer for those. dcost.-----------------------KANDAN 4000 12000 4000 NITIN 4000 30000 10000 SANKAR 1000 10000 5000 Display the highest.NARAYANAN C 4000 4000 NITIN JAVA 30000 30000 RITA ACCESS 4000 4000 SANKAR C 10000 7000 SANKAR HTML 10000 10000 SENTHIL C++ 5000 5000 SIVA ORACLE 3000 3000 Display each institute name with number of students. 17 LANGUAGE DIFFERENCE ----------------ACCESS 3666. min(salary) min. dcost-sold. 16 COUNT SPLACE -------------3 BANGALORE 2 CHENNAI 1 MADURAI 2 TIRUNELVLI 1 TRIVANDRUM Display the average difference between scost and dcost for each language select dev_in as Language. abs(avg(scost-dcost)) as Difference from software group by dev_in. avg(salary) avg from programmer where salary>2000. dcost-sold "TO BE RECOVERED" from software where sold<dcost group by pname.splace from studies group by splace.

'YYYY')<1983) or pname in (select pname from programmer where sex='F' and to_char(dob. salary from (select * from programmer where salary=(select max(salary) from programmer where (prof1='C' or prof2='C'))) 20 PNAME SALARY ---------.---------.--------RITA 03-NOV-06 Display the details of the software that was developed by male programmers born before 1965 and female programmers born after 1975 select * from software where pname in (select pname from programmer where sex='M' and to_char(dob.salary) in (select prof1. 'YYYY')>1975).Who is the highest paid C programmer? select pname.-------. 24 PNAME TITLE DEV_IN SCOST DCOST SOLD ---------.-------25000 C 15000 C++ 15000 JAVA 20000 JSP 30000 ORACLE Who is the least experience programmer? select pname.max(salary) from programmer group by prof1) PNAME ---------NARAYANAN SENTHIL SIVA KUMAR 22 RITA SALARY PROF1 ---------.prof1 from programmer where (prof1. 23 PNAME DOJ ---------.---------SENTHIL POWERPOINT C++ 3000 5000 15000 SIVA EXCEL ORACLE 1000 3000 20000 RITA EXCEL ACCESS 2000 4000 12000 Classification: Sensitive .salary.-------------------.---------NARAYANAN 25000 Who is the highest paid female COBOL programmer? select pname.max(salary) max from programmer where sex='F' and prof1='HTML' or prof2='HTML' group by pname 21 PNAME MAX ------------------RITA 30000 Display the name of the highest paid programmer for each language (prof1) select pname. doj from programmer where doj=(select max(doj) from programmer).---------.

Display the name of programmers who have not developed any package. select pname from programmer where pname not in (select pname from software) group by pname 25 PNAME ------KUMAR Classification: Sensitive .