SQL Queries

1)Display the details of all employees a)select * from emp; 2)Display the depart informaction from department table a)select * from dept; 3)Display the name and job for all the employees a)select ename,job from emp; 4)Display the name and salary for all the employees a)select ename,sal from emp; 5)Display the employee no and totalsalary for all the employees a)select empno,sal+comm as total from emp group by empno; 6)Display the employee name and annual salary for all employees. a)select ename,sal * 12 as annualsalary from emp; 7)Display the names of all the employees who are working in depart number 10. a)select emame from emp where deptno=10; 8)Display the names of all the employees who are working as clerks and drawing a salary more than 3000. a)select ename from emp where job='CLERKS' and sal>3000; 9)Display the employee number and name who are earning comm. a)select empno,ename from emp where comm is not null; 10)Display the employee number and name who do not earn any comm. a)select empno,ename from emp where comm is null; 11)display the names of employees who are working as clerks,salesman or analyst and drawing a salary more than 3000. A)select ename from emp where job='CLERK' OR JOB='SALESMAN' OR JOB='ANALYST' AND SAL>3000; 12)display the names of the employees who are working in the company for the past 5 years; a)select ename from emp where to_char(sysdate,'YYYY')to_char(hiredate,'YYYY')>=5; 13)Display the list of employcees who have joined the company before 30-JUN-90 or after 31-DEC-90. a)select ename from emp where hiredate < '30JUN-1990' or hiredate > '31-DEC-90'; 14)Display current Date. a)select sysdate from dual; 15)Display the list of all users in your database(use catalog table). a)select username from all_users; 16)Display the names of all tables from current user; a)select tname from tab; 17)Display the name of the current user. a)show user 18)Display the names of employees working in depart number 10 or 20 or 40 or employees working as CLERKS, SALESMAN or ANALYST. a) Select ename from emp where deptno in(10,20,40) or job in('CLERKS','SALESMAN','ANALYST'); 19) Display the names of employees whose name starts with alphabet S. a)select ename from emp where ename like 'S%'; 20) Display the Employee names for employees whose name ends with Alphabet S. a) Select ename from emp where ename like '%S'; 21) Display the names of employees whose names have second alphabet A in their names. a) Select ename from EMP where ename like '_A %'; 22) select the names of the employee whose names is exactly five Characters in length. a) select ename from emp where length(ename)=5; 23) Display the names of the employee who are not working as MANAGERS. a) Select ename from emp where job not in ('MANAGER'); 24)Display the names of the employee who are not working as SALESMAN OR CLERK OR ANALYST. A)select ename from emp where job not in('SALESMAN','CLERK','ANALYST'); 25) Display all rows from EMP table. The system should wait after every Screen full of information. a) Set pause on

29)Display the minimum salary from emp table.pf 5% salary.max(sal) from emp group by deptno. 39)Display empno. 32)Display the maximum salary being paid to depart number 20. 37)Display the names of the employee in descending order of salary.sal sort the output first base on name and within name by deptno and with in deptno by sal. a)select deptno. 38)Display the names of the employee in order of employee name. 33)Display the minimum salary being paid to any SALESMAN. 49)Display the various jobs along with total salary for each of the jobs where total salary is greater than 40000.sal*12 from emp order by sal desc. 47)Display the various jobs and total salary for each job a)select job.count(deptno)from emp group by deptno.salary. a)select ename.total salary for each employee.sal/100*5 as pf.e the name of the employee earning lowest salary should salary appear first.The name of the employee earning highest annual salary should apper first. 30)Display the average salary from emp table.count(deptno) from emp group by deptno having count(*)>3.hra 15% of salary.deptno. a) select empno.sal. 36)Display the names of the employee in order of salary i. a)select ename from emp order by sal desc. a)select min(sal) from emp. a)select ename from emp order by ename. a)select max(sal) from emp.ename. a)select sum(sal) from emp. 48)Display the depart numbers with more than three employees in each dept. 27) Display the total salary beiging paid to all employees. 50)Display the various jobs along with total number of employees in each job.sal 40)Display the name of the employee along with their annual salary(sal* 12). a)select deptno. 41)Display name. 46)Display the various jobs and total salary for each job a)select job.sal from emp order by ename.da 10% of salary. 45)Display the depart numbers and max salary for each department. a)select deptno.sum(sal) from emp group by job. 44)Display the depart numbers and total salary for each department.ename. a)select min(sal) from emp where job='SALESMAN'. a) Select count (*) from EMP. 28)Display the maximum salary from emp table.hra. a)select ename from emp order by sal.total salary will be(salary+hra+da)-pf. a)select avg(sal) from emp. a)select sum(sal) from emp where job='ANALYST' and deptno=40. 34)Display the average salary drawn by MANAGERS.sal/100*15 as hra. a)select deptno. a)select avg(sal) from emp where job='MANAGER'. a)select job.26) Display the total number of employee working in the company.pf.count(job)from emp group by job. a)select max(sal) from emp where deptno=20.sum(sal) from emp group by job having sum(sal)>40000.min(sal) from emp group by job. a)select max(sal) from emp where job='CLERK'.sum(sal) from emp group by deptno. a)select ename. 43)Display the various jobs and total number of employees within each job group.sal/100*10 as da. 42)Display depart numbers and total number of employees working in each department. 35)Display the total salary drawn by ANALYST working in depart number 40. a)select job. The output should be in the order of total salary. 31)Display the maximum salary being paid to CLERK.deptno.deptno.The output should contain only those jobs with more than three employees.sal+sal/100*15+sal/100*10-sal/100*5 as total from emp. .da.

'B') from dual 72)Display the informaction from emp table.deptno from emp where sal in(select max(sal) from emp group by deptno).e the out put should be 'ac'. a)select substr('oracle'.'a'. a)select ename. a)select lower(ename)from emp 65)Display the names of the employees in Propercase.count(empno) from emp group by job having count(job)>3 51)Display the name of the empployee who earns highest salary. a)select ename from emp where deptno=(select deptno from dept where dname='ACCOUNTING') 59)Display the employee names who are working in Chicago. a)select upper(ename)from emp 64)Display the names of the employees in Lowecase.e 'Computer Maintenance Corporation'. 53)Display the names of salesman who earns a salary more than the highest salary of any clerk. 63)Display the names of the employees in Uppercase.a)select job. a)SELECT JOB. 68)select name of the employee concatenate with employee number. 66)Display the length of Your name using appropriate function. 57)Display the names of the employees who earn highest salaries in their respective job groups. 61)Display the names of employees from department number 10 with salary grether than that of any employee working in other department.1) FROM DUAL 71)Replace every occurance of alphabhet A with B in the string Allens(use translate function) a)select translate('Allens'. 55)Display the names of employees who earn a salary more than that of Jones or that of salary grether than that of scott. a)select ename. a)select length('name') from dual 67)Display the length of all the employee names. select ename||empno from emp. a)select ename from emp where sal=(select max(sal) from emp). a)select initcap(ename)from emp.3.'A'.sal from emp where sal> (select sal from emp where ename='JONES')and sal> (select sal from emp where ename='SCOTT').sal from emp where job='SALESMAN' and sal>(select max(sal) from emp where job='CLERK'). a)select empno. 56)Display the names of the employees who earn highest salary in their respective departments.2) from dual 70)Find the First occurance of character 'a' from the following string i. i. a)SELECT INSTR('Computer Maintenance Corporation'.ename from emp where where job='CLERK' and sal=(select max(sal) from emp where job='CLERK'). 62)Display the names of the employees from department number 10 with salary greater than that of all employee working in other departments.SUM(SAL) FROM EMP GROUP BY JOB HAVING SUM(SAL)>(SELECT MAX(SAL) FROM EMP WHERE JOB='MANAGER'). A)select ename from emp where job='CLERK' and sal>(select min(sal) from emp where job='SALESMAN'). a)select ename from emp where deptno=(select deptno from dept where LOC='CHICAGO') 60)Display the Job groups having total salary greater than the maximum salary for managers. 69)User approprate function and extract 3 characters starting from 2 characters from the following string 'Oracle'. a)select ename from emp where deptno=10 and sal>all(select sal from emp where deptno not in 10).Where job manager is found . 52)Display the employee number and name for employee working as clerk and earning highest salary among clerks.sal. 54)Display the names of clerks who earn a salary more than the lowest salary of any salesman.sal.job from emp where sal in(select max(sal) from emp group by job) 58)Display the employee names who are working in accounting department. a)select ename. a)select length(ename) from emp. a)select ename. a)select ename from emp where deptno=10 and sal>any(select sal from emp where deptno not in 10).

82)Display the common jobs from department number 10 and 20.mgr. s)select ename.ename. a)select ename from emp where length(ename)>4.mgr=e. 73)Display empno.ename from emp e.deptno 93)Display ename who are working in sales dept. a)select distinct(job) from emp where deptno=10 85)Display the details of those who do not have any person working under them. 78)scott has joined the company on wednesday 13th August ninten nintey.Instead of display department numbers display the related department name(Use decode function).empno group by e.2 0. a)select to_char(sysdate. a)select distinct(job) from emp where deptno=10 or deptno=20 or select distinct(job) from emp where deptno in(10.'10-sep-77') from dual 76)Display the current date as 15th Augest Friday Nineteen Ninety Saven.'hh:MM:ss') from dual. 79)Find the date for nearest saturday after current date. a)select empno.empno=e.emp p where e. 92)Display all employees while their dept names.ename) from emp e.20).'SATURDAY')FROM DUAL. 74)Display your age in days. a)SELECT NEXT_DAY(SYSDATE.mgr). 83)Display the jobs found in department 10 and 20 Eliminate duplicate jobs.ename='JONES'.emp m where m.ename.emp m where m.ename from emp. 91)Display those employees whose salary is more than 3000 after giving 20% increment.'day ddth Month year') from EMP.2)>3000.'SALES'. a)select p. 80)display current time. a)select to_date(sysdate)-to_date('10-sep77')from dual 75)Display your age in months. 86)Display the details of those employees who are in sales department and grade is 3.3) from dual. 88)Display those employee whose name contains not less than 4 characters. a)select add_months(sysdate.dname from emp.'BOSS') FROM EMP.mgr and e. 81)Display the date three months Before the current date.empno=e. a) select * from emp where deptno=(select deptno from dept where dname='SALES')and sal between(select losal from salgrade where grade=3)and (select hisal from salgrade where grade=3). i)display the managers names a)select distinct(m. a)select ename from emp where deptno=(select deptno from dept where dname='SALES'). a)select e. 89)Display those department whose name start with "S" while the location name ends with "K".ename having count(*)=1.ename) from emp e. 87)Display those who are not managers and who are managers any one. 84)Display the jobs which are unique to department 10.'MANAGER'.empno=p.decode(deptno. a)select job from emp where deptno=10 and job in(select job from emp where deptno=20).deptno from emp table.emp e where emp.it should be displayed as boos(Use replace function). a)select to_char(sysdate.deptno=dept.'ddth Month day year') from dual 77)Display the following output for each row from emp table.'ACCOUNTING'. a)select replace(JOB. a)select months_between(sysdate. . a)select dname from dept where dname like 'S%' and loc like '%K'. ii)display the who are not managers a)select ename from emp where ename not in(select distinct(m. a)select ename.30.dept where emp.'OPRATIONS') from emp.'RESEARCH'. 90)Display those employees whose manager name is JONES.10. a)select ENAME||' HAS JOINED THE COMPANY ON '||to_char(HIREDATE.sal from emp where (sal+sal*.40.

ename from emp e.ENAME='JONES'.empno=p.job and his manager.SAL BETWEEN LOSAL AND HISAL AND EMP. a)select ename from emp where mgr is null 98)Display grade and employees name for the dept no 10 or 30 but grade is not 4 while joined the company before 31-dec82.deptno. EMP P WHERE E.JOB. a)select p.SAL)ORDER BY SAL DESC. 97)Display those employees who are not working under any manager.job.grade and depart name for every one in the company except 'CLERK'.EMP. 106)Display the employee name.ename from emp e.manager name.mgr 107)Find out the top 5 earners of company? a)SELECT DISTINCT SAL FROM EMP E WHERE 5>=(SELECT COUNT(DISTINCT SAL) FROM EMP A WHERE A.SAL>=E.DEPARTMENT.mgr and p.ename.empno(+)=e.his grade and make out an under department wise? a)SELECT E.mgr and p.sal>e.LOC IN('CHICAGO'.DNAME.job.HIREDATE.MGR AND E.SALGRADE.emp e where d.dname. a)select ename.JOB.empno=p.MGR AND EMP.dname from dept d.DEPTNO=DEPT.JOB.deptno. 102)dISPLAY THOSE EMPLOYEES WHOSE MANAGER NAME IS JONES? --[AND ALSO DISPLAY THEIR MANAGER NAME]? A) SELECT P.EMP E.DEPTNO=DEPT.DEPT WHERE SAL BETWEEN LOSAL AND HISAL AND EMP.emp p where e.sal.30) and grade<>4 and hiredate<'31-DEC-82'. 103)Display name and salary of ford if his salary is equal to hisal of his grade a)select ename.DEPTNO AND JOB NOT IN('CLERK')ORDER BY SAL ASC.E.salary.sal.94)Display employee name.salgrade where sal between losal and hisal and deptno in(10.DEPT WHERE EMP. 110)Select count of employee in each department where count greater than 3? a)select count(*) from emp group by deptno having count(deptno)>3 111)Display dname where at least 3 are working and display only department name? a)select distinct d.LOCATION from emp. 104)Display employee name.GRADE FROM EMP. 95)Display those employees whose salary greter than his manager salary. 99)Update the salary of each employee by 10% increment who are not eligiblw for commission.job.emp e where emp.LOCATION FOR ALL WHO ARE WORKING AS MANAGER? A)select ename.salgrade where sal between losal and hisal and ename ='FORD' AND HISAL=SAL.DEPTNO=DEPT. a)update emp set sal=sal+sal*10/100 where comm is null. a)SELECT EMPNO.ename AS Manager from emp. 100)SELECT those employee who joined the company before 31-dec-82 while their dept location is newyork or Chicago.LOC FROM EMP.deptno=e.deptno=dept.grade from emp.DEPT where mgr is not null.dept where sal between 2000 and 5000 and loc='CHICAGO' and emp.ENAME.emp p where e.DEPTNO ORDER BY DNAME 105)List out all employees name.DEPTNO)AND HIREDATE <'31-DEC-82' AND DEPT.Sort on salary display the highest salary? a)SELECT ENAME.SAL.EMPNO=P. 109)Display those employee whose salary is equal to average of maximum and minimum? a)select ename from emp where sal=(select max(sal)+min(sal)/2 from emp).SALGRADE.ENAME FROM EMP E.deptno and 3>any (select count(deptno) from emp group by deptno) . a)select p.Display also employee who are without manager? a)select e.sal 96)Display those employees who are working in the same dept where his manager is work.grade from emp.DNAME.JOB.ENAME. a)select ename.deptname. 108)Display name of those employee who are getting the highest salary? a)select ename from emp where sal=(select max(sal) from emp).salary and comm for those sal in between 2000 to 5000 while location is chicago.depart name .GRADE FROM EMP.e.'NEW YORK').DNAME.ENAME.deptno=e.DNAME.comm from emp.EMPNO=E. 101)DISPLAY EMPLOYEE NAME.DEPT WHERE (EMP.eMP.

deptno.? a)SELECT DISTINCT SAL FROM EMP E WHERE 5>=(SELECT COUNT(DISTINCT SAL) FROM EMP A WHERE A.EMP E WHERE EMP.sal.ENAME FROM EMP.sal.EMP E WHERE EMP.SUBSTR(hiredate.sal.EMPNO=E.SAL)ORDER BY SAL DESC. 133)Display the grade of jones? a)SELECT ENAME.deptno) 121)delete those records from emp table whose deptno not available in dept table.EMPNO=E.SALGRADE WHERE SAL BETWEEN LOSAL AND HISAL AND Ename='JONES'.SAL <(SELECT AVG(EMP.deptno not in(emp.'MON')='DEC'.sal=e.-2. 130)Display those employee whose first 2 characters from hiredate -last 2 characters of salary? a)select ename. or select ename from emp where ename like('%A %').sal+nvl(comm.SAL>(SELECT AVG(SAL) FROM EMP).SAL.'RESEARCH')).ENAME FROM EMP . if the maximum job period is 30 years? a) 125)Display those employee whose salary is ODD value? a)select * from emp where sal<0.comm.(SELECT SUM(SAL) FROM EMP) FROM EMP. 127)Display those employee who joined in the company in the month of Dec? a)select ename from emp where to_char(hiredate.EMP E WHERE E. a) 123)Display employee name.'A')>0. 119)Display those manager who are not working under president but they are working under any other manager? a) 120)Display those department where no employee working? a)select dname from emp.ENAME.0) >any (select sal from emp) 115)Display those employees whose salary is less than his manager but more than salary of any other manager? a) 116)Display all employees names with total sal of company with each employee name? a)SELECT ENAME. a) 122)Display those enames whose salary is out of the grade available in salgrade table.EMPNO=E.ename from emp.SAL<=E.2)||ENAME|| substr(sal. 134)Display those employees who joined the company before 15 of the month? a)select ename from emp where to_char(hiredate.MGR AND EMP. 129)Display those employee whose deptno is available in salary? a)select emp. 114)Display employee name.MGR.MGR GROUP BY EMP.GRADE FROM EMP.1.MGR AND E.'YY')=sal*0. 126)Display those employee whose salary contains alleast 3 digits? a)select * from emp where length(sal)>=3.0) as NetPay from emp where sal+nvl(comm. 117)Find out last 5(least)earners of the company. .comm and whose net pay is greater than any other in the company? a) 124)Display name of those employee who are going to retrie 31-DEC-99.ENAME) AND EMP. 132)Display those employee who are working in sales or research? a)SELECT ENAME FROM EMP WHERE DEPTNO IN(SELECT DEPTNO FROM DEPT WHERE DNAME IN('SALES'.'DD')<15.2) from emp 131)Display those employee whose 10% of salary is equal to the year of joining? a)select ename from emp where to_char(hiredate.SAL<E.comm and net pay for those employee whose net pay is greter than or equal to any other employee salary of the company? a)select ename. 113)Display those managers name whose salary is more than average salary of his employee? a)SELECT DISTINCT EMP.EMP.1.SAL) FROM EMP WHERE EMP.ENAME FROM EMP. emp e where emp. 128)Display those employees whose name contains "A"? a)select ename from emp where instr(ename.dept where emp.112)Display name of those managers name whose salary is more than average salary of his company? a)SELECT E.EMPNO=E. 118)Find out the number of employees whose salary is greater than their manager salary? a)SELECT E.

a) 139)Display those employees who are working as manager.ename='BLAKE'. a) 141)Display the name of the dept those employee who joined the company on the same date? a) 142)Display those employees whose grade is equal to any number of sal but not equal to first number of sal? a) 143)Count the no of empployee working as manager using set operaction? a) 144)display the name of the employees who joined the same date.'FRIDAY')) when to_char(hiredate.2) . ( case when to_char(hiredate.sal.(case when sal>1500 then 'Below_target' when sal=1500 then 'On_targer' when sal<1500 then 'less than target' else 'kkkkk' end )from emp 150)WHICH query to calcuate the length of time any employee has been with the company? 151)Give a string of the format 'nn/nn' Verify that the first and last 2 characters are numbers. 136)Delete those records where no of employees in a particular department is less than 3. a) 145)Display the manager who is having maximum number of employees working under him? a) 146)list out employee name and salary increased by 15% and expressed as whole number of Dollars? a) 147)Produce the output of the emp table "EMPLOYEE AND JOB" for ename and job? a) 148)List all employee with hiredate in the format 'june 4 1988'? a) 149)Print lost of employees displaying "just salary" if more than 1500 if exactly 1500 display 'On target' if less than 1500 Display below 1500? A)select ename.mgr=e. a)select ename from emp where to_char(hiredate.ename from emp.'FRID AY')). a) 138)Display the name of the department where no employee working.hiredate.empno and e.0. Those hired after 15th are paid the last Friday of the following month. 153)Display those manager who are getting less than his employee salary? a) 154)Print the details of all the employees who are Sub-ordinate to BLAKE? a)select emp.1).'DD')<15.And that the middle character is '/' Print the exprection 'Yes' if valid 'No' of not valid Use the following values to test your soluction '$12/54(Not clear).'DD')<=15 then last_day(next_day(hiredate.last_day(next_day(hiredate. a) 140)Count the no of employees who are working as manager(using set operations). a)delete from emp where deptno=(select deptno from emp group by deptno having count(deptno)<3).135)Display those employee who has joined before 15th of the month.their hire date and first pay date scort those whose salary contains first digits of their deptno? a) select ename. 137)Display the department name the no of characters of which is equal to no of employee in any other department.Print a list of employees. 155)Display those who are working as manager using CO-relate sub-query? a) 156)Display those employee whose manager name is jones and also with his manager name? . a) 152)Employee hire on 15th of any month are paid on the last Friday of that month.'FRIDA Y')) end )from emp order by substr(sal. emp e where emp.deptno.'DD')>15 then last_day(next_day(add_months(hiredate.

job. Sort the output by salary? a) 183)If the pay day is next friday after 15th and 30th of every month.what is the next pay day from their hire date for employee in emp table? a) .1000 Sort the output by salary? a) 163)List ename.000 a year or more? a) 159)Find out how many managers are there with out listing them? a) 160)Find out the average salary and average total remuneration for each job type remember sales man earn commission? a) 161)Check whether all employees number are indeed unique? a) 162)List out the lowest paid employees working for each manager exclude any groups where minimum salary is less than Rs.000 a year or who are not Clerks? a) 164)Find out the job that was failedin the first half of 1983 and same job that was failed during the same period on 1984? a) 165)Find out the employees who joined the company before their manager? a) 166)List out all the employees by name and number along with their manager's name and number also display %NG who has no manager? a) 167)Find out the employee who earned the highest salary in each job type Sort in desending salary order? a) 168)Find out the employees who earned the minimum salary for their job in Assending order? a) 169)Find out the most resently hired employees in each department Order by hiredate? a) 170)Display ename.annual sal.dname and grade who earn $36.a) 157)Define variable representing the expression used to calculate on employee total Annual Remunatation? a) 158)Use the variable in a statement which finds all employees who can earn $30.deptno.salary and deptno for each employee who earn a salary greater than the average for then department order by deptno? a) 171)Display the department where there are no employees? a) 172)Display the department no with highest annual remunaration bill as compensation? a) 173)In which year did most people join the company Display the year and number of employees? a) 174)Display the average salary figure for the department? a)select avg(SAL) from emp group by deptno 175)Write a query of display against the row of the most recently hired employees Display ename Hiredate and column max date showing. a) 176)Display employee who can earn more than lowest salary in department no 30? a) 177)Find employees who can earn more than every employee in deptno? a) 178)Select dept name deptno and sum of salary? a) 179)Find out average salary and average total remainders for each job type? a) 180)Find all departments which have more than 3 employees? a) 181)Check whether employees number are unique? a) 182)List lowest paid employees working for each manager exclude any groups where the minimum salary less than 1000.

203. a) alter table emp add(ename varchar2(20)). Create table emp with only one column empno.SAL. Delete the 10th record of emp table. alter table emp add(sal number(10)). Select ename if ename exists more than once.LENGTH(ENAME)) FROM EMP.SAL*. Display the 10th record of emp table without using group by and rowid? A) SELECT * FROM EMP WHERE ROWNUM<11 MINUS SELECT * FROM EMP WHERE ROWNUM<10 189. 194. Add in now.1. For the time being I have decided that I will not impose this validation. I want to give a validation saying that salary cannot be greater 10. 192. follows Display those employees name as A ALLEN B BLAKE A) SELECT SUBSTR(ENAME.3. a) SELECT REVERSE(ENAME)FROM EMP. 196. Display those employee whose joining of month and grade is equal. A) create table emp as select empno from emp where 1=2. A) 198.sal.3)|| SUBSTR(UPPER(ENAME). a) create table new_table as select * from emp where 1=2. a) alter table emp modify(ename varchar2(30)). 201. Create a copy of emp table. A) SELECT ENAME FROM EMP WHERE TO_CHAR(HIREDATE. My boss has agreed to pay more than 10. 199.1). Add this column to emp table ename vrachar2(20). Display those employee whose joining DATE is available in deptno. a) alter table emp add primary key(empno).PF(20% OF SAL) from emp. And it is a policy in your company to have a review after 9 months the joined date (and of 1st of next month after 9 months )how many days from today your employees has To wait for a review? a) 185)Display employee name and his salary whose salary is greater than highest average of department number? a)SELECT SAL FROM EMP WHERE SAL>(SELECT MAX(AVG(SAL)) FROM EMP GROUP BY DEPTNO). 200. 197. Oops I forgot give the primary key constraint. 193. A) SELECT ENAME FROM EMP WHERE SAL BETWEEN(SELECT LOSAL FROM SALGRADE WHERE GRADE=TO_CHAR(HIREDATE. Display RSPS from emp without using updating inserting. List out the employees ename.'MM')) AND (SELECT HISAL FROM SALGRADE WHERE GRADE=TO_CHAR(HIREDATE. Display all enames in reverse order? (SMITH:HTIMS).'MM')).000. 191. Now increase the length of ename column to 30 characters.'DD')=DEPTNO 195.000(note give a name to this constraint) a) alter table emp add constraint chk_001 check(sal<=10000) 204. a) again alter the table or drop constraint with alter table emp drop constraint chk_001 (or)Disable the constraint by using .2 AS PF FROM EMP. A) DELETE FROM EMP WHERE EMPNO=(SELECT EMPNO FROM EMP WHERE ROWNUM<11 MINUS SELECT EMPNO FROM EMP WHERE ROWNUM<10) 190. Add salary column to emp table. 186)Display the 10th record of emp table(without using rowid) a) SELECT * FROM EMP WHERE ROWNUM<11 MINUS SELECT * FROM EMP WHERE ROWNUM<10 187)Display the half of the ename's in upper case and remaining lowercase? a) SELECT SUBSTR(LOWER(ENAME). a) select ename from emp e group by ename having count(*)>1. 188. 202.1. A) SELECT ENAME.184)If an employee is taken by you today in your organisation.ENAME FROM EMP.

dept where emp.000. 218. 206.dept where emp. a)delete from emp where rowid not in(select min(rowid)from emp group by ename) 207. Give the command to add the constraint. a) create table newemp as select * from emp.deptno 217.e.mgr. a) alter table emp add constraint dept_001 foreign key(deptno) reference dept(deptno) [deptno should be primary key] 210.dept where emp.dname from emp. Display employee number. Display employee name and his manager name.dname even if there are no employees working in a particular department(use outer join).ename from emp e. a) delete from emp where (sysdatehiredate)/365>2.ename. a) Add column called as mgr to your emp alter table emp add(mgr number(5)).alter table emp modify constraint chk_001 disable.Goto your first system. 220.Are the above changes reflected in this user?(yes) 2. My boss has changed his mind. Delete the rows of employees who are working in the company for more than 2 years. a) select ename.deptno=dept. A) alter table <table_name) add constraint <constraint_name> <constraint type> 211. Display ename. Display employee name and department name for each employee. A) ALTER TABLE EMP ADD CONSTRAINT MGR_DEPT FOREIGN KEY(MGR) REFERENCES EMP(EMPNO) 208.dname from emp. so revoke that salary constraint.deptno(+) 219. 223. Display itemname and total sales amount for each item.deptno group by dname. a) select itemname.empno=p. Create table called as newemp. a) select dname.deptno. 209. 216. This deptno column should be related to deptno column of dept table. Provide a commission(10% Comm Of Sal) to employees who are not earning any commission.dept where 1=2.dname from emp.deptno=dept. 214. 221.deptno=dept.name and location of the department in which he is working. Create table called as newemp. 205.1 where comm is not null.dname.deptno=dept. a) select dname. Give a command to add this constraint. Display the department name along with total salary in each department. Oh! This column should be related to empno. Give the following commands: Delete from emp where job 'clerk' Inset into emp without giving any further commands move to another client system and log into the same user give the following command select * from emp. a) select p.sum(sal) from emp. 212. Ans:Changes Will be affect in second system.dept where emp.deptno group by dname.sum(amount) from item group by itemname.1 from emp where comm is null 215.deptno=dept.dname from emp. a) alter table emp modify constraint chk_001 enable. alter table emp add(deptno number(5)). This table should contain only empno. 222.ename. a) select empno.emp p where e. a) update emp set comm=sal*.count(ename) from emp. Come back to second system and give the following command Select * from emp. .dept where emp. a) select empno. Using single command create this table as well as get data into this table(use create table as). table. a) Add deptno column to your emp table. Q)Write a Query To Delete The Repeted Rows from emp table. Now he doesn't want to pay more than 10.ename. a) select sal*0.loc. and give commit.ename. 213. If any employee has commission his commission should be incremented by 10% of his salary. a) create table newemp as select empno. 1. Display the department name and total number of employees in each department.

avg(ccost) from studies group by inst.title from software. 3)Display the number of male and female programmers. 16)Display the sales cost of the packages developed by each programmer languagewise. a)select to_char(dob. a)select count(title) from software group by dev_in. a)select prof1. a) 13)Display the cost of package developed by each programmer. a)select pname. a)select sex. a)select count(course) from studies group by course. 21)Display the names of male programmers. 8)Display the number of people in each salary group.count(inst)from studies group by inst.'YY'). a) 15)Display the number of packages sold by each programmer. except c & c++.max(sold) from software group by dev_in.'MM'). 23)Display the number of packages in each language.sum(dcost) from software group by dev_in. a)select to_char(dob.'Cpp') group by dev_in. a)select dev_in. 4)Display the costiest package and the highest selling package developed in each language. 20)Display each institute name with number of students.count(salary) from programer group by salary. 6)Display the number of people joined in each month. a) 18)Display the name of each programmer with the costiest package cheapest package developed by him/her. a) 19)Display each institute name with number of courses and average cost per course. 24)Display the number of packages in each language for which development cost is greater than 1000. a)select dev_in.count(course). 10)Display the number of people who studied in each group.count(prof1) from programer group by prof1.count(dob) from programer group by to_char(dob.count(dob) from programer group by to_char(dob.max(dcost).count(sex) from programer group by sex. a)select count(title) from software where dev_in not in('C'. a)select pname. 5)Display the number of people born in each year. a)select inst. a)select count(inst) from studies group by inst. SOFTWARE & STUDIES TABLES __________________________________________________ ____ 1)Display the number of packages developed in each. 9)Display the numeber of people in each institute. 7)Display the language-wise count of prof1. a)select count(title) from software group by pname. 2)Display the number of packages developed by each person.'YY'). a)select pname from programer where sex='M'. 12)Display the total selling cost of the packages developed in each language. 22)Display the programmers name and packages developed by him/her.scost+dcost from software. a) 17)Display the language name with average development cost and selling cost. a)select inst. 14)Display the sales value of the packages developed by each programmer. a)select salary./ Download File | Save to my Yahoo! Briefcase ] Plain Text Attachment [ QUERIES BASED ON PROGRAMMER. 11)Display the Total development cost of the packages developed in each language.'MM'). . a)select count(pname) from software group by pname.

'Cpp'.salary from programer where salary=(select max(salary) from programer where prof1='C' or prof2='C').avg(salary) from programer where salary>2000. a)select pname. a) 48)What is the price of the costiest software developed in Basic. a)select pname. 37)Display the names and ages of all the programmers. a)SELECT MIN(CCOST) FROM STUDIES. a)select avg(scost-dcost) from software.a)select count(title) from software where dcost>1000 group by dev_in. 33)Which language is known by only one programmer.'Oracle'. a)select max(doj)from programer where prof1='Pascal' or prof2='Pascal'. a)SELECT * FROM SOFTWARE WHERE SOLD>2000.oracle or dbase. 35)Which female programmer earining more than 3000 does not know c. 36)Find out the average selling cost for packages developed in pascal. a)SELECT COUNT(COURSE) FROM STUDIES WHERE INST='SABHARI'.c++. 32)Who is the most experienced programmer in PASCAL.min(salary). 44)How many programmers studied at SABHARI. a)select max(salary).'MON')='JAN'. a)SELECT SUM(SOLD*SCOST) FROM SOFTWARE.lowest and average salaries for those earning more than 2000. a) 28)Who is the highest paid c programmer. a) 47)Display the details of packages for which development cost has been recovered. 30)Display the names of the highest paid programmer for each language prof1. a)select avg(scost * sold) from software where dev_in='Pascal'.'Oracle'. a)select pname. 42)How much revenue has been earned through the sale of packages developed. a) 34)Who is the youngest programmer knowing dbase. a)select pname.'Dbase') . 38)Display the names of those who have done the DAP course. a)select pname from studies where course='DAP'.'Dbase') and prof2 not in('C'. a)select pname from programer where dob=(select max(dob) from programer where prof1='Dbase' or prof2='Dbase'). which should be sold in order to recovered the development cost of each packages. 26)Display highest. 45)Display the details oF packages whose sales crossed the 2000 mark.'Cpp'. 46)Find out the number of copies. a)select pname from programer where sex='F' and salary>3000 and prof1 not in('C'.(sysdate-dob)/365 as age from programer. 40)Display the lowest course fee. 27)Display the total scost. a)select min(doj)from programer. a)SELECT * FROM SOFTWARE WHERE PNAME='RAMESH'.salary from programer where salary=(select max(salary) from programer where sex='F' and prof1='Cobol' or prof2='Cobol'). a)select pname from programer where salary in(select max(salary) from programer group by prof1) 31)Who is the least experienced programmer. 43)Display the details of the software developed by RAMESH. a)SELECT COUNT(COURSE) FROM STUDIES WHERE COURSE='PGDCA'. 41)How many programmer have done the PGDCA course. a)SELECT SCOST FROM SOFTWARE WHERE SCOST=(SELECT MAX(SCOST) FROM .dcost and amount to be recovered for each programmer by those whose dcost has not yet been recovered.dob from programer where to_char(dob. 29)Who is the highest paid female cobol programmer. 39)Display the name and date of birth of all programmers born in january. 25)Display the average difference between Scost and Dcost for each lnaguage.

70)Which package has the highest development cost. 63)Which institute has maximum number of students. a)select course from studies where ccost=(select max(ccost) from studies). 49)How many packages are developed in Dbase. a) 75)Which language was used to develop the highest number of packages. a)select title from software where dcost=(select max(dcost) from software).course from studies where ccost<(select avg(ccost) from studies). a)select * from programer where prof1 not in('Clipper'. 52)How many programmers know either cobol or pascal. a)select max(sysdate-dob)/365 from programer where sex='M'. a)select count(*) from programer where sex='F'. 62)Display the details of those who do not know clipper. 55)What is the average age of female programmers. a)SELECT COUNT(TITLE) FROM STUDIES WHERE DEV_IN='DBASE'. 67)Which institute conducts the costiest course. a)select dev_in from software where dcost=(select max(dcost)from software).'Cobol'.STUDIES WHERE DEV_IN='BASIC'). a) 69)Display the names of the courses whose fees are within 1000/. a)select course from studies where ccost<1000. a)select prof1.'Pascal'). 53)How many programmers do not know pascal & c. 51)Display the details of programmers knowing c.'mm')=to_char(sysdate. 61)How many people draw between 2000 and 4000. a) .of the course. a)select pname from programer where to_char(dob.'mm'). a)SELECT * FROM PROGRAMER WHERE PROF1='C' or prof2='C'. 60)What is the average salary. a)select avg(salary) from programer. a) 65)Display the name of the institue and course which has below average course fee. a)select pname. 73)Which language was used to develop the package having highest cost. 59)What are the language known by the male programmers.'Pascal')and prof2 not in('C'. a) 64)Which course has been done by the maximum number of students. 74)How many copies of the packages that has the least difference between developemt and selling cost were sold. 50)What is the average coursefee.prof2 from programer where sex='M'. a)select inst.(sysdate-doj)/365 from programer order by pname desc. a)select pname from software where sold=(select min(sold)from software). 58)How many female programmers are there. 57)Who are the programmers who celebrate their birthdays during the current month. a)select avg(sysdate-dob)/365 from programer where sex='F' 56)Calculate the experience in years for each programmer and siplay along with the names in descending order. a)select course.'Pascal') 54)How old is the oldest male programmer.'Cobol'. 71)Which package has lowest selling price. a)SELECT AVG(CCOST) FROM STUDIES.cobol or pascal. 66)Which is the costiest course. a)select title from software where dcost=(select min(dcost) from software) 72)Who developed the package that has sold the least number of copies. a)select count(*) from programer where salary between 2000 and 4000.inst from studies where ccost=(select max(ccost) from studies) 68)Which course has less than the average number of students. a)SELECT count(pname) FROM PROGRAMER WHERE PROF1='Cobol' or prof2='Pascals'.'Pascal') and prof2 not in('Clipper'. a)SELECT count(pname) FROM PROGRAMER WHERE PROF1 not in('C'.

81)Who is the oldest female programmer who joined in 1992. a)select pname from programer where dob=(select max(dob) from programer where sex='F' and to_char(doj.'YYYY')=1965). 82)In which year were the most number of programmers were born. a) 84)Who are the male programmers earning below the average salary of the female programmers. 78)Display the names of the packages which is sold less than the average. number of copies sold and sales value of each programmer institute wise. a) 87)Display the details of those who are drawing the same salary. a) 92)Display the number of packages. a) 99)Who are the programmer who have the same Prof. a) 91)Display the details of the software develoed in c by female programmers of pragathi. a)select title from software where sold<(select avg(sold) from software). a) 100)Display the total sales value of software. a) 93)Display the details of the software developed in Dbase by male programmers who belong to the institute in which most number of programmers studied. a) 103)How much does the person who developed the highest selling package earn and what course did he/she undergo. a)select pname from programer where dob=(select max(dob) from programer where sex='M' and to_char(dob. a) 90)Display the details of the programmers who joined before 1990. a) 80)Who is the youngest male programmer born in 1965. a) 88)Display the details of the software developed by the male programmers earning more than 3000. institute wise. a) 97)What is the total cost of the software developed by programmer by apple. a) . a) 83)In which language are most of the programmers proficient. a) 95)Display the details of the software that was developed in the language which is neither the first nor the second proficiency of the programmers. a)select pname from software where dcost=(select min(dcost) from software). a) 98)Who are the programmer who joined in the same day.'YYYY')=1992). 79)Who are the authors of the packages which have recovered more than double the development cost. a) 96)Display the name of the programmers who have not developed any package. a) 94)Display the details of software developed by the male programmers born after 1965 and female programmers born before 1975. a) 89)Display the details of the packages developed in pascal by female programmers. a) 101)In which institute is the person who developed the costilest package.2. a) 102)Which language listed in prof1 and prof2 has not been used to develop any package. a)select pname from programer where sex='F' and salary>(select max(salary) from programer where sex='F') 86)which language has been stated as profile by most of the programmers. a) 77)Who is the author of costliest package.76)Which programmer has developed the highest number of packages. a)select pname from programer where sex='M' and salary<(select avg(salary) from programer where sex='F') 85)Who are the female programmers earning more than the highest paid male programmers.

a) 124)What is the average development cost of a package developed in cobol. a) 114)Display the details of those who will have experience of 2 years of service this year. a) 113)List the programmer names(from the programmer table) and the number of packages each has developed. a) 108)How many packages were developed by the person who develped the cheapest package and where did she/he study from. a) 107)How many packages were developed by students who studied in institute that charge the lowest corse fee. a) 123)What is the length of the shortest name in programmer table.dob(dd/mm/yy format)for all programmers. a) 121)Display the names of programmers whose names contaion upto 5 characters. a) 110)How many packages were developed by the most experienced programmer from bdps.sex. a) 126)Who are the programmers who were born on the last day of the month. a) 109)In how many packages female programmers are earning more than the male programmer. a) 119)How many different courses are mentioned in the studies table. a) 129)Display the names of the packages whose names contains more than 1 word. a) 105)Which is the constiest package developed by a person with udnder 5 years Experience. without using conversion function. a) 117)Find out the cost of the software developed by Mary. a) 106)What is the average salary for those whose softwares sales value is more than 50000. a) 125)Display the name. a) 130)Display the name. a) 122)How many female programmers knowing cobol have more than 2 years experience. a) 111)List the programmer(from software table) and the institutes they studied including those who did not develop any package. a) 118)Display the institute name from the studies table without duplicates. a) . a) 120)Display the names of the programmers whose names contain 2 concurrence of the. a) 127)What is the amount paid in salaries of the male programmers who don't know cobol. a) 112)List each prof with the number of programmers having that prof and the number of packages developed in that prof. a) 115)Calculate the amount to be recovered for those packages whose development cost has not yet been recovered.job. a) 116)List the package which has not been sold so far.odj of those month of birth & month of joining are the same.104)How many months will it take for each programmer to recover the cost of the course he/she underwent. a) 128)Display the Title______________________And ______________in descending order of differences.

Sign up to vote on this title
UsefulNot useful