This action might not be possible to undo. Are you sure you want to continue?
if u want to add a column with not null if data exists in the
table.use default value. alter table ashu add (location varchar2(20) default 'x' not null)
1. List the employee number,name,job,title and hiredate of employee in department 10? select EMPNO, ENAME,JOB,MGR,HIREDATE from emp where deptno=10; 4. Select the name and salary of all employee who are clerks? select ENAME,SAL from emp where job='CLERK'; 5. Select the name and annual salary of all employees? select ename,sal*12 annualsalary from emp; 6. List the name,job,salary of everyone hired on december 17,1980? select ename,sal,job from emp where HIREDATE='17-DEC-1980'; 7. List the department name and department number for departments with numbers greater than or equal to 20? select deptno,dname from dept where deptno>=20; 8. List all employee who have a salary between 1000and 2000? select * from emp where sal between 1000 and 2000; 9. List the names of employees whose salaries are less than 2500? select ename from emp where sal <2500; 10. Select the name,salary and commission of employees whose commission is greater than their salary? select empno,SAL,COMM from emp where comm > sal; 11. Display the name, monthly salary and daily salary and hourly salary for
Order the result by department number? select * from emp where job='MANAGER' or job='PRESIDENT' order by deptno 16. 15)Select the information about manager and the president from the column job in the table emp.job. rename the columns as monthly. .30.empno from emp where job='MANAGER' and sal>2600 order by ename. 14.daily.sal/22 dailysalary . List the employee name that do not end with "S"? Select ename from emp where ename not like ‘%S’.deptno=e. List the name.e.dname from emp e . List employee details working in department 20.ename between 'C' and 'G'. List the employee name that start with "C"? select ename from emp where ename like ‘C%’. List the details of employees in departments 10 and 20 in alphabtical order of name ? Select * from emp where deptno in (10.ename. 17.20) order by ename.sal monthlysal . sal/(22*8) hourlysalary from emp.30 or 40? Select * from emp where deptno in (20. dept d where d.hourly? Select ename. 19.deptno and e.employees assume that the sal column in the table is the monthly salary.d. 18.job and department of everyone whose name falls in the alphabetic range "C" to "F"? select e.and that there are 8 working hours in a day. 12. List the names and employer's numbers of managers who earn more than 2600 display in alphabetic order by name? Select ename. that there are 22 working days in a month. Display all employee names who have TH or LL in them? Select ename from emp where ename like ‘%TH%’ or ename like ‘%LL%’. 13.40).
Display all employee who were hired during 1983? select ename from emp where to_char(hiredate.mgr. 24.ename. 26. List of employees whose names start with "M" and end with "R"? Select ename from emp where ename like ‘M%’ and ename like ‘%R’.by comverting the null values in comm column to 0? select empno. .hiredate.COMM FROM EMP WHERE ENAME NOT IN (SELECT ENAME FROM EMP WHERE COMM > 0). select ename||' has held the position of '||job||' in department '||deptno||' since '||hiredate from emp 23. List all employees who do not get any commission? SELECT ENAME.Accept salary prompt 'enter value for salary'? select * from emp where job='&job' AND SAL='&SAL'.job.'yyyy')=1983 22. Allen has held the position of salesman in department 30since 13 june 1983. Ward has held position of salesman in department 30 since 13 june 1983. List all rows from emp table . Write a query that will accept a given job title and display all records according to that title .0) from emp. 21.sal from emp where job='SALESMAN' or job='MANAGER' and sal>1500 25. Display the data as shown below: Smith has held the position of clerk in department 20 since 10 june'83.nvl(comm. List all managers and salesman with salaries over 1500? select ename.20.job.sal.
List the names and hiredate of the employees in dept 20 .This sql figures in emp table are for each month? select deptno.job. List the names of all employees whose hire date anniversary is in the month of december? select ename from emp where to_char(hiredate. the sql comm figures in the emp table are for each month.28.TO_char(hiredate.max(sal). In one query. 34.count(comm) "Comm" from emp where deptno=30 33. avg(sal) from emp group by deptno. Calculate the total compensation expense for each dept. Display hire date formatted as '12/03/84'? SELECT ENAME.min(sal) from emp where job in(‘CLERK’.’MANAGER’). 29. Compute the average.'mm')=12 31. How many months has the president worked for the company? round th the nearest whole number of months? select round(months_between (sysdate.'dd/mM/yyyy') FROM emp WHERE DEPTNO=20.hiredate). Give sql command to find the average salary per job in each dept .count the number of people in dept 30 who can receive a salary and the number of people who receive a commission? select count(sal) "salary". Assume that employees who do note earn a commission receive non monetary benefits that are worth $100 a month? .job 32. for one year .0) from emp where job='PRESIDENT' 30.minimun and maximum salaries of those groups of employees having the job clerk or manager? Select avg(sal).
0)+sum(nvl(comm.HIREDATE.0)+100)*12) "Total" from emp group by deptno / 35.SUM(SAL) SAL FROM EMP GROUP BY DEPTNO.ENAME. .3*(select sal from emp where Job=’PRESIDENT’). Do a case insensitive search for a list of employees with a job that a user enters(e. 40. 39. Which employees earn less than 30% ot the president's salary? Select ename from emp where sal < 0. Produce the following output ****** employee -------smith (clerk) select ename ||'('||job||')' "employee" from emp.MGR .(nvl(sum(comm)*12.select deptno. Create a view consisting of number of all the columns from emp table and their corresponding records from dept.COMM .SAL.EMPNO. table consisting of dname&location? CREATE VIEW DEPTEMP_VIEW AS select e. 38. e. Create a view consisting of number of employees and their total sum of salary grouped by deptno? CREATE OR REPLACE VIEW EMP_VIEW AS SELECT COUNT(ENAME) ENAME.g. e.JOB . clerk)? select ename from emp where job=upper('&job'). 36. e. e. e. e. 37. Who was the last employee hired in each department? Select MAX(HIREDATE) from emp GROUP BY DEPTNO.
Print a list of employees displaying just salary if more than 1500/if exactly 1500.e. dept d where e.DEPT WHERE EMP. Determine the average salaries of employees? SELECT AVG(SAL) FROM EMP.deptno.LOC FROM EMP.deptno=emp.dept where dept.deptno=d. 41.DEPTNO=DEPT.loc='NEW YORK' And dept. 43.deptno. Find the number of different employees and the number of departments? SELECT COUNT(DISTINCT(ENAME)).COUNT(DISTINCT(DEPTNO)) FROM EMP. List the employee names and the cities in whiech they work order by city? SELECT ENAME.dept where dept. 47.loc='NEW YORK' and dept.DEPTNO from emp e. display "BELOW TARGET"? SELECT ENAME ONTARGET FROM EMP WHERE SAL>=1500 AND SAL<1500. Which employees work in NEW YORK? Select ename from emp. Which a query to display as following ? ename date-hired ______ _________ Smith June Fourteenth 1983. *****44. select ename. 45.deptno=emp.DEPTNO ORDER BY LOC. 42. How many employees work in newyork? select COUNT(*) from emp.to_char(hiredate. 46.'ddspth-mon-yy') from emp. if less than 1500 .deptno. . display "ON TARGET".
COUNT(DISTINCT(DEPT. 52.48.SUM(SAL).COUNT(DISTINCT( DEPT.DEPT. Display only those jobs where the minimum salary is greater than or equal to 3000? Select job. Find out the diffenence between highest and lowest salaries? SELECT MAX(SAL)-MIN(SAL) FROM EMP.E1. Display all employee names and their department names in department order? SELECT EMP. 54. 51. 49.DEPT.MGR.DNAME)) .ENAME). List lowest paid employees working for each manager? SELECT DISTINCT(E1.DEPTNO FROM EMP GROUP BY DEPTNO.DNAME FROM EMP. department name.SAL FROM EMP WHERE SAL >= 3000.min(sal) from emp having min(sal) >= 3000 group by job SELECT JOB.SAL < E2. 55.MGR=E2.ENAME.DEPT WHERE .DEPTNO)).SUM(COMM).E1.location and local commission paid and total salary of each department? SELECT COUNT(DISTINCT(EMP.EMP E2 WHERE E1.SAL FROM EMP E1. Checkwhether all employees numbers are indeed unique? ****SELECT EMPNO FROM EMP. Find all departments which have more than 3 employees? SELECT DEPTNO FROM EMP GROUP BY DEPTNO HAVING COUNT(*) >3 53.SAL.MGR AND E1. List the department number.LOC)) FROM EMP. 50. Display the average monthly salary bill for each job type within a department? SELECT AVG(SAL).
DEPTNO.HIREDATE FROM EMP E1.DEPT.MGR=E2.HIREDATE.DEPT WHERE EMP.HIREDATE < E2.SAL FROM EMP .department number and name? SELECT EMP. Display the department that has TWO employees? SELECT DEPTNO FROM EMP GROUP BY DEPTNO HAVING COUNT(*) = 2 ****58. 56.DEPTNO.EMP. Find all employees who have same job as blake? SELECT ENAME. Find the employees who earn more than the lowest salary in dept 30? SELECT COUNT(*) FROM EMP WHERE DEPTNO=30 AND SAL > (SELECT MIN(SAL) FROM EMP WHERE DEPTNO=30) 61.JOB FROM EMP WHERE JOB IN (SELECT JOB FROM EMP WHERE ENAME='BLAKE').DEPTNO=DEPT.DEPTNO.DEPT. Find all employees who joined the company before their manager? SELECT DISTINCT(E1. 60.DEPTNO=DEPT. 62.EMP E2 WHERE E1.MGR.ENAME.ENAME). Display employees who has earn more than lowest salary in dept 30? SELECT ENAME.E1.DEPTNO ORDER BY EMP. 59.DNAME FROM EMP.SAL FROM EMP WHERE DEPTNO=30 AND SAL > (SELECT MIN(SAL) FROM EMP WHERE DEPTNO=30).E1. Display all employee name. 57. Find employees who earn more than every employee in dept 30? SELECT ENAME.MGR AND E1.
69. Delete all information on dept10 from emp table? DELETE FROM EMP WHERE DEPTNO=10. 67.DEPT WHERE DNAME='SALES').hiredate for employees whose salary is greater than the highest salary in the sales department? SELECT ENAME.JOB. Create synonym on emp table? CREATE SYNONYM SYN_EMP FOR EMP. Find the job with the highest average salary? Select job FROM EMP where sal in (select max(avg(sal)) from emp group by job). Create indexs on empno on emp table? CREATE INDEX INDEX_EMP ON EMP(EMPNO). List all tables which are created on a particular date? select OBJECT_NAME from user_objects where OBJECT_TYPE='TABLE' AND CREATED='&CREATED'. Copy all information on dept10 into the D10 history table? INSERT INTO D10 SELECT * FROM DEPT10. 68. 64. 65. 66.job. Create in cluster table/cluster index on emp(dept no) and dept(dept no)? ***** Create cluster emp_clus emp(deptno).HIREDATE FROM EMP. .WHERE DEPTNO=30 AND SAL > any(SELECT distinct(SAL) FROM EMP WHERE DEPTNO=30) 63.DEPT WHERE SAL>(SELECT MAX(SAL) FROM EMP. Fisplay the name. 70.
job. 73.DEPT WHERE DEPT. List all synonym which are created for a particular table and date? select OBJECT_NAME from user_objects where OBJECT_TYPE=' SYNONYM' AND CREATED='&CREATED'.display ename. 75.hiredate & column name showing " * " and column name maxdate (for unique records)? 76.DEPTNO=EMP. List the emp name & salary increased by 15% and expressed as whole no of dollars? . 78. Select Ename.DEPTNO) 77.DEPTNO FROM EMP WHERE JOB=’&JOB’.DEPTNO FROM EMP.SAL. List all the objects which are created on a particular date? Select object_name from user_objects WHERE CREATED='&CREATED'.salary. Display asterisk against the row of the most recently hired employees.71.JOB. 74. List all views which are created for a particular date and table? select OBJECT_NAME from user_objects where OBJECT_TYPE='VIEW' AND CREATED='&CREATED'.deptno for a given job title? SELECT ENAME.MGR.mgr. Delete rows from dept table of those deptnumbers do not have matching rows in the emp table? DELETE FROM DEPT WHERE DEPTNO NOT IN (SELECT EMP. List all indexs which are created in a particular date and table? 72.
dname. hiredate.job .15.e.'$9.remember salesman earn commision? Select avg(sal).dept d Where e. Find avg salary & avg total remunation for each job title.dept name for every one in the company except clerks.salary .9999.deptno=d.SELECT ENAME .job.deptno order by sal desc.'dd-mon-yy') "review date" from emp order by hiredate 80. 85.grade of employees who earn $36000a year or who are clerks? . 86. List the min & max for each job type? select min(sal). 79. List the ename.'fmday') FROM dual 82.avg(nvl(comm.deptno. Display each employee name with hiredate & review date .order output in assending review date order? select ename.YY? SELECT TO_CHAR(to_date('&HIREDATE'. TO_CHAR( ADD_MONTHS( hiredate .TO_CHAR(SAL+SAL*.ename. assume review date is one year after hiredate.dname from emp e. Find all dept's which have more than 3 employees? SELECT DEPTNO FROM EMP GROUP BY DEPTNO HAVING COUNT(*) >3.grade.for any date entered in the format DD. 12).sal.99') FROM EMP. List the employee name . 84.job <> 'CLERK' and e.annual salary.e.d. 83.'Dd-mm-yy').MM. Write query which will return the day of the week.0)) from emp group by job.max(sal) from emp group by job.job.sort on salary displaying the highest salary first? Select e.
display their name and salary? Select * from (select sal from portal30_demo.salary. In which year did most people join the company?display the year and number of employees? Select to_char(hiredate.’yyyy’).d.ename. 87.deptno for any employee who earns a salary greater than the average for their dept sort in dept order? Select ename.sal.dname from emp e.job=’CLERK’ and (e. 88.sal*12.count(ename) from emp 90.Select e.emp group by sal order by sal desc) where rownum <4 89. Find all employees whose dept is not in the dept table ? Select ename from emp Where deptno not in (select deptno from dept) 92.dept d Where e.sal*12)=36000. job || 'sales person' . produce the folowing output.e. ENAME DEPTNO JOB ______ ________ ____ ALLEN 30 sales person WARD 30 sales person BLAKE 30 manager Select ename.deptno from emp where sal> any(select avg(sal) from emp group by deptno) order by deptno. Show name.sal from emp where Sal > any(select avg(sal) from emp group by deptno).e. Find employees who earn a salary greater than the average salary for their dept? Select ename. It has been dicovered that the sales people in dept 30 are not males. 91.job. Who are the top3 carners in the company.
DEPTNO=10 AND DEPT. 97.DEPT WHERE EMP. Display the name. POSSIBLE.SAL.. List employees in deptno10 with the same job as anyone in the sales dept? SELECT EMP. POSSIBLE. 95.DEPT WHERE DNAME='SALES').ENAME. EMP E2 .JOB FROM EMP. 98:Retrieve the name. 96.'MANAGER').job. department. Enter this query: SELECT POSSIBLE. of any employee whose salary is above average for his or her department.DEPT WHERE SAL>(SELECT MAX(SAL) FROM EMP. 93.EMP.ENAME.DEPT = AVERAGE.HIREDATE FROM EMP.salary for employees whose salary is greater than the highest salary in SALES dept? SELECT ENAME.DEPT) .DNAME='SALES'.JOB.ENAME) FROM EMP E1. Find the employee who earns the min salary? SELECT MIN(SAL) FROM EMP. 94.DEPT. List the employees having the same job as employees located in chicago? SELECT DISTINCT(E1.SALARY FROM EMPLOYEE POSSIBLE WHERE SALARY > (SELECT AVG (SALARY) FROM EMPLOYEE AVERAGE WHERE POSSIBLE. List employees with eaither the same job as jones or a salary greater than or equal to ford's order by job and salary? SELECT ENAME FROM EMP WHERE SAL > (SELECT SAL FROM EMP WHERE ENAME='FORD') OR JOB IN (SELECT JOB FROM EMP WHERE ENAME='JONES') ORDER BY JOB.deptno from emp where deptno=30 and job in('SALESMAN'.hiredate . and salary.
List employee whose salary is equal to that of SCOTT or WARD? SELECT ENAME FROM EMP WHERE SAL IN (SELECT SAL FROM EMP WHERE ENAME=’SCOTT’ OR ENAME=’WARD’).emp b where a. Write a query to display 5th row to 7th row of Emp Table? SELECT * FROM (SELECT ROWNUM <alias>. Write a query to delete the Duplicate rows for Emp table? DELETE FROM <table_name> WHERE (ROWID.1/count('SALESMAN')) sal from portal30_demo.portal30_demo. Write a query to display the 2nd Max Salary earning employee? .JOB IN (SELECT E2.emp a.job = b.no > &n and A.job = 'SALESMAN' group by a. <column> FROM <table_name> GROUP BY <column>).and jones should not be deleted? 101.sal 100.WHERE E1.DEPTNO) 98. 104.column name> FROM <table_name> ORDER BY <column name>))<alias> --inline function WHERE A.b.DEPTNO=D. Set salaries of all salesman equal to 1.no < &m . 99.job and a.job.JOB FROM EMP E2.sal*1.1 times the average salary of salesman? select a. Delete all employees with the same job jones. Write a query to get the below output 102. < column>) NOT IN (SELECT MIN(ROWID). round(b.DEPT D WHERE D.job.<column name> FROM (SELECT <no.LOC='CHICAGO' AND E2. 103.
emp where sal not in (select max(sal) sal from portal30_demo.State. .emp) 105.City.Pincode.select max(sal) from portal30_demo.Addressline2.---------104)Query to get different packages from specified schema: select * from dba_objects where object_type='PACKAGE' and object_name like 'XXCCR%'. Write a query to display the address each as an individual column like Ename Addressline1 Addressline2 City Pincode State Country ------------------------------------.Country’ .-----.----.---------. Assume the Employee Address is like ‘Addressline1.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.