You are on page 1of 5

1.

Find out the selling cost average for packages developed in PASCAL

SQL>select avg (cost) from pgm where dev_in='pascal';

AVG(SCOST)
----------
600

2.Display the Names and Ages of all the Programmers.

SQL>select name as name, floor((sysdate-dob)/365)as age from pgm;

NAME AGE
-------------------- ---------
bala 28
riya 20
kanan 22
mano 26
kathir 24
sam 23
anand 26

3.Display the Names of those who have done the DAP Course

SQL> select name from study where course='dap';

NAME
---------------
mano

4.What is the HIGHEST number of copies sold by a package.

SQL> select max(sold) from soft;

MAX(SOLD)
---------
2000

5.Display the NAMES AND DATE OF BIRTH of all programmers born in JANUARY.

SQL> select name,dob from pgm where to_char(dob,'mon') like 'jan';

NAME DOB
-------------------- ---------
sam 16-JAN-96

6.Display the LOWEST course fee

SQL> select min(ccost)from study;

MIN(CCOST)
----------
2000

7.HOW MANY programmers have done PGDCA Course

SQL> select name from study where course='pgdca';

NAME
---------------
anand
kanan
sam
revathi

8.How much revenue has been earned thru� sale of packages developed in C

SQL> select sum(scost*sold) from soft where dev_in='c';

SUM(SCOST*SOLD)
---------------
68740

9.Display the details of the software develpoed by RAMESH

SQL> select name,title from soft where name ='ramesh';

NAME TITLE
-------------------- --------------------
ramesh hotel mgmt
ramesh payroll pack

10.HOW MANY programmers studied at SABHARI

SQL> select count(name) from study where splace='sabhari';

COUNT(NAME)
-----------
2

11.Display the Details of PACKAGES whose sales CROSSED the 2000 mark.

SQL> select name from soft where(scost*sold)>2000;

NAME
--------------------
ram
sam
karthi
anand
kathir
babu
riya
mary
revathi
ramesh
ramesh
12.Find out he NUMBER OF COPIES which should be sold in order to recover the
DEVELOPMENT

13.Display the details of packages for WHICH developments cost has been recovered

SQL> select max(scost) from soft where (scost*sold)>dcost;

MAX(SCOST)
----------
12000

14.What is the price of the costliest software developed in BASIC

SQL> select max(dcost)from soft where dev_in='basic';

MAX(DCOST)
----------
2200

15.HOW MANY packages were developed in DBASE

SQL> select count (name) from soft where dev_in = 'dbase';

COUNT(NAME)
-----------
3

16.HOW MANY programmers studied at PRAGATHI

SQL> select count (name) from study where splace='pragathi';

COUNT(NAME)
-----------
1

17. HOW MANY programmers paid 5000 to 10000 for their course

SQL> select count(name) from soft where dcost>=5000 and scost<=10000;

COUNT(NAME)
-----------
4

18.What is the Average course fee

SQL> select avg(ccost) from study;

AVG(CCOST)
----------
5666.6667

19.Display the DETAILS of programmers knowing C

SQL> select * from pgm where prof1='c' or prof2='c';

NAME DOJ DOB SEX PROF1 PROF2


SALARY
-------------------- --------- --------- ------ --------------- ---------------
---------
bala 08-JAN-10 11-DEC-90 male basic c
2500

20.HOW MANY programmers know either COBOL or PASCAL

SQL> select count(name) from pgm where prof1 not in('cobol','pascal') or prof2
in('cobol','pascal');

COUNT(NAME)
-----------
4
21.HOW MANY programmers DON�T know PASCAL & C

SQL> select count(name) from pgm where prof1 not in('pascal','c') and prof2 not
in('pascal','c');

COUNT(NAME)
-----------
5

22.HOW old is the OLDEST male programmer

SQL> select max(floor((sysdate-dob)/365)) from pgm where sex='male';

MAX(FLOOR((SYSDATE-DOB)/365))
-----------------------------
28

23.What is the AVERAGE age of female Programmers

SQL> select avg(floor((sysdate-dob)/365)) from pgm where sex='female';

AVG(FLOOR((SYSDATE-DOB)/365))
-----------------------------
23

24.CALCULATE the experience in Years for each programmers and display along with
the names, in DESCENDING order

SQL> select name , floor ((sysdate-doj)/365) as experience from pgm order by name
desc;

NAME EXPERIENCE
-------------------- ----------
sam 0
riya 1
mano 3
kathir 1
kanan 2
bala 9
anand 1

You might also like