1.  
  2. How many programmers don’t know C and C++?

SELECT TRUNC(MAX(MONTHS_BETWEEN(SYSDATE,DOB)/12)) FROM PROGRAMMER WHERE SEX = ‘M’;

  1. How old is the oldest male programmer?

SELECT TRUNC(AVG(MONTHS_BETWEEN(SYSDATE,DOB)/12)) FROM PROGRAMMER WHERE SEX = ‘F’;

  1. What is the average age of female programmers?

SELECT PNAME, TRUNC(MONTHS_BETWEEN(SYSDATE,DOJ)/12) FROM PROGRAMMER ORDER BY PNAME DESC;

  1. Calculate the experience in years for each programmer and display along with their names in descending order.

SELECT PNAME FROM PROGRAMMER WHERE TO_CHAR(DOB,’MON’) = TO_CHAR(SYSDATE,’MON’);

  1. Who are the programmers who celebrate their birthdays during the current month?

SELECT COUNT(*) FROM PROGRAMMER WHERE SEX = ‘F’;

  1. How many female programmers are there?

SELECT DISTINCT(PROF1) FROM PROGRAMMER WHERE SEX = ‘M’;

 

  1. What are the languages known by the male programmers?

SELECT AVG(SAL) FROM PROGRAMMER;

  1. What is the average salary?

SELECT COUNT(*) FROM PROGRAMMER WHERE SAL BETWEEN 5000 AND 7500;

  1. How many people draw 5000 to 7500?
  2. SELECT * FROM PROGRAMMER WHERE PROF1 NOT IN (‘C’,’C++’,’PASCAL’) AND PROF2 NOT IN (‘C’,’C++’,’PASCAL’);

 

 

  1. Display the details of those who don’t know C, C++ or Pascal.

.SELECT ‘Mr.’ || PNAME || ‘ – has ‘ || TRUNC(MONTHS_BETWEEN(SYSDATE,DOJ)/12) || ‘ years of experience’ “Programmer” FROM PROGRAMMER WHERE SEX = ‘M’ UNION SELECT ‘Ms.’ || PNAME || ‘ – has ‘ || TRUNC (MONTHS_BETWEEN (SYSDATE,DOJ)/12)  || ‘ years of experience’ “Programmer” FROM PROGRAMMER WHERE SEX = ‘F’;

Advertisements