SQL Answer
SQL Answer
COPIES
---------20
20
Display the names and date of birth of all programmers born in January?
PNAME
DOB
---------- --------NITIN
10-JAN-83
Display the lowest course fee
CCOST
---------6000
4
How many programmers have done the PGDCA course?
Classification: Sensitive
How much revenue has been earned thru the sales of package developed in C?
REVENUE DEV_IN
-------------49000
C
Display the details of packages whose sales crossed the 2000 mark?
PNAME
TITLE
DEV_IN
SCOST
DCOST
SOLD
---------- -------------------- -------- ---------- ---------- ---------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, course from studies where ccost between 5000 and 10000;
PNAME
COURS
-------------SANKAR
DAP
SIVA
DAP
TINKU
DPA
MARTIN
DPA
TOM MOODY PCP
What is the average course fee?
AVG(CCOST)
---------11444.4444
How many programmers know either COBOL or PASCAL?
10
COUNT
------4
How old is the oldest male programmer?
AGE
---------43
Classification: Sensitive
select pname, scost, title from software group by pname, scost, title;
12
PNAME
SCOST TITLE
---------- ---------- -------------------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
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, average selling cost and average price per
copy
14
15
select pname, dev_in, max(dcost) max, min(dcost) min from software group
by pname, dev_in
PNAME
DEV_IN
MAX
MIN
---------- -------- ---------- ---------KANDAN ACCESS
12000
12000
Classification: Sensitive
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.
16
COUNT SPLACE
-------------3
BANGALORE
2
CHENNAI
1
MADURAI
2
TIRUNELVLI
1
TRIVANDRUM
Display the average difference between scost and dcost for each language
17
LANGUAGE DIFFERENCE
----------------ACCESS
3666.66667
C
6000
C++
2000
HTML
9000
JAVA
26000
ORACLE
2000
Display the total scost, dcost and the amount to be recovered for each programmer for those, whose
dcost has not yet been recovered
18
PNAME
TOTAL
DCOST
TO BE RECOVERED
------------------- -----------------------KANDAN
4000
12000
4000
NITIN
4000
30000
10000
SANKAR
1000
10000
5000
Display the highest, lowest and average salaries for those earning more than 2000
19
MAX
MIN
AVG
---------- ---------- ---------30000
15000 20714.2857
Classification: Sensitive
20
PNAME
SALARY
---------- ---------NARAYANAN
25000
Who is the highest paid female COBOL programmer?
21
PNAME
MAX
------------------RITA
30000
Display the name of the highest paid programmer for each language (prof1)
SALARY PROF1
---------- -------25000
C
15000
C++
15000
JAVA
20000
JSP
30000
ORACLE
23
PNAME
DOJ
---------- --------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
24
PNAME
TITLE
DEV_IN
SCOST
DCOST
SOLD
---------- -------------------- -------- ---------- ---------- ---------SENTHIL POWERPOINT
C++
3000
5000
15000
SIVA
EXCEL
ORACLE
1000
3000
20000
RITA
EXCEL
ACCESS
2000
4000
12000
Classification: Sensitive
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