SQL Interview Questions2
1. Find out the selling cost average for packages developed in Oracle.
SELECT AVG(SCOST) FROM SOFTWARE WHERE DEVIN = ‘ORACLE’;
2. Display the names, ages and experience of all programmers.
SELECT PNAME,TRUNC(MONTHS_BETWEEN(SYSDATE,DOB)/12) “AGE”, TRUNC(MONTHS_BETWEEN(SYSDATE,DOJ)/12) “EXPERIENCE” FROM PROGRAMMER;
3. Display the names of those who have done the PGDCA course.
SELECT PNAME FROM STUDIES WHERE COURSE = ‘PGDCA’;
4. What is the highest number of copies sold by a package?
SELECT MAX(SOLD) FROM SOFTWARE;
5. Display the names and date of birth of all programmers born in April.
SELECT PNAME, DOB FROM PROGRAMMER WHERE DOB LIKE ‘%APR%’;
6. Display the lowest course fee.
SELECT MIN(CCOST) FROM STUDIES;
7. How many programmers have done the DCA course.
SELECT COUNT(*) FROM STUDIES WHERE COURSE = ‘DCA’;
8. How much revenue has been earned through the sale of packages developed in C.
SELECT SUM(SCOST*SOLD-DCOST) FROM SOFTWARE GROUP BY DEVIN HAVING DEVIN = ‘C’;
9. Display the details of software developed by Rakesh.
SELECT * FROM SOFTWARE WHERE PNAME = ‘RAKESH’;
10. How many programmers studied at Pentafour.
SELECT * FROM STUDIES WHERE SPLACE = ‘PENTAFOUR’;
11. Display the details of packages whose sales crossed the 5000 mark.
SELECT * FROM SOFTWARE WHERE SCOST*SOLD-DCOST > 5000;
12. Find out the number of copies which should be sold in order to recover the development cost of each package.
SELECT CEIL(DCOST/SCOST) FROM SOFTWARE;
13. Display the details of packages for which the development cost has been recovered.
SELECT * FROM SOFTWARE WHERE SCOST*SOLD >= DCOST;
14. What is the price of costliest software developed in VB?
SELECT MAX(SCOST) FROM SOFTWARE GROUP BY DEVIN HAVING DEVIN = ‘VB’;
15. How many packages were developed in Oracle ?
SELECT COUNT(*) FROM SOFTWARE WHERE DEVIN = ‘ORACLE’;
16. How many programmers studied at PRAGATHI?
SELECT COUNT(*) FROM STUDIES WHERE SPLACE = ‘PRAGATHI’;
17. How many programmers paid 10000 to 15000 for the course?
SELECT COUNT(*) FROM STUDIES WHERE CCOST BETWEEN 10000 AND 15000;
18. What is the average course fee?
SELECT AVG(CCOST) FROM STUDIES;
19. Display the details of programmers knowing C.
SELECT * FROM PROGRAMMER WHERE PROF1 = ‘C’ OR PROF2 = ‘C’;
20. How many programmers know either C or Pascal?
SELECT * FROM PROGRAMMER WHERE PROF1 IN (’C’,’PASCAL’) OR PROF2 IN (’C’,’PASCAL’);
Last 5 posts in SQL Interview Questions2
Related Posts
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.












Leave a Reply