1)

List all the employees working in departments present in location 'NEW YORK', 'BANGALORE' using sub query. Use table EMP and DEPT 2) Using sub query, Display employee name, job, hire date, salary from EMP table who is not a clerk and salary is less than the maximum salary of a clerk order employee names in alphabetical order. 3) Explain the use of Exists operator using an example of sub query. 4) Is the below mentioned query correct. If no then please correct the query.
Select * From Emp Where Mgr = (Select Empno From Emp Where Job = 'MANAGER')

5) Give an example of correlated sub query. 6) Using sub query, List the name of all departments which is having an average salary less than the average salary of 'ACCOUNTING' department. Use table EMP and DEPT. 7) List the name, job and salary of all employees having fifth highest salary using EMP table. 8) Use EMP table, list the Employee number, Name & Job of all employees working under employee ‘FORD’ using sub query. 9) Explain the use of ‘ANY’ operator using sub query. 10) Use EMP table, list employee name, job, salary and manager name of the employee having salary less than the salary of a 'SALESMAN' 11) Write a sub query using table Employee and Dependent to list the name of employees having one female child. 12) Write a query to generate output in the format given below using EMP and DEPT tables. X-Axis data represents departments, Y-Axis represents cities and cell value represents number for employees working in each department of the city.

16) Using EMP table. display list of departments name and number of people working in each department and staying in “Houston”. 5) Explain the use of double amberscent (i. write a query to list all the records from table. write a query to list fname. job and hire date of employees where more than one people joined on the same day. write a query to list employee name . &) in SQL Plus. write a query to list all the employees from EMP table with job as input parameter. 15) Using EMP table. Use input parameters for table name and where clause. 6) Explain the use of DEFINE and UNDEFINE commands with an example. 1) Using SQL Plus. lname and salary from employees table in the format given below. . 2) Using SQL Plus. Use tables Department and Employee 18) Using EMP table. write a query to find the name of employee who joined first. find the name. list all the department names and sum of salary department wise. 4) Using SQL Plus. 7) How do you display value of a variable before and after it is being changed in SQL Plus. ENAME. JOB and SALARY from EMP table with order by clause as input parameter.13) Using EMP table. 9) Using SQL Plus. write a query to list all the employees from EMP table with where clause as input parameter. 19) Using sub query. list all the employees who earn salary more than there manager. 20) Using sub query. 8) Using SQL Plus. location from dept table with department name truncated to 4 characters as shown below.e. find the name of employee who has worked in more than two departments. Explain with an example. write a query to list all the employees who joined before there managers joined and after the “PRESIDENT” joined. department name. write a query to list all the EMP NO. 3) Using SQL Plus. find the name of employee not working under “PRESIDENT” and salary is less than the average salary of a “CLERK” 17) Using sub query. 14) Using EMP table.

generate output as shown below.11) Using SQL Plus. 18) Explain with an example how to enforce leading zeros to a number field. 10) Using EMP table. 16) Using EMP table.where ever mgr field is null it should display as ‘No Manager’ 17) Explain the use of “SET VERIFY ON” command. generate output in the format given below. 20) Using EMP table. write a query to list job. . generate output in the format given below. Note:. employee number & name from emp table with job displayed only once for the employees. Output should be as shown below.

The result sets of both the queries must have the ______ number of columns. we must place the ORDER BY at the __________ of the entire statement. Select Statement 2) Two SELECTs can be combined into a compound query by a set operation only if they satisfy the two conditions. 11) ______ Takes the result set of one SELECT statement. (Ans should by given only after Dry RUN) EMP_TABLE ENAME DEPTNO SAL . 6) How many times ORDER BY clause can be used in Select Query 7) Give generic syntax of a query involving a set operation 8) UNION ALL ______ the results of two SELECT statements into ______ result set. The ______ of each column in the second result set must match the datatype of its corresponding column in the first result set Note: The datatypes do not need to be the same if those in the second result set can be automatically converted by Oracle (using implicit casting) to types compatible with those in the first result set. Union Queries d. and removes those rows that are also returned by a second SELECT statement. Give and example of each with description 5) If we want to use ORDER BY in a query involving set operations. Set Queries c. and then eliminates any duplicate rows from that result set. 12) For below question System should not be used.1) SQL statements containing these set operators are referred to as a. compound queries b. 3) Operators used to combine the results from two or more SELECT statements is named as _________ 4) List all the SET OPERATORS which Oracle Provided. 9) _____ Returns only those rows that are returned by each of two SELECT statements 10) _____ Combines the results of two SELECT statements into ____ result set. b. a.

LocID From DEPT_TABLE .Sal From EMP_TABLE Intersect Select Deptno.E1 E2 E4 E5 E3 E6 D1 D2 D3 D1 D3 D2 10000 10000 10000 20000 3000 40000 LOCID L1 L2 L3 L4 DEPT_TABLE DEPTNO DEPT_NAME D1 Deptno1 D2 Deptno2 D3 Deptno3 D4 Deptno4 What will be the result if someone executes? a) Select Deptno From EMP_TABLE Union Select Deptno From DEPT_TABLE b) Select Deptno From EMP_TABLE Union All Select Deptno From DEPT_TABLE c) Select Deptno From EMP_TABLE Minus Select Deptno From DEPT_TABLE d) Select Deptno From DEPT_TABLE Minus Select Deptno From EMP_TABLE e) Select Deptno From DEPT_TABLE Intersect Select Deptno From EMP_TABLE f) Select Deptno.

41.Use Paper and execute by yourself) Select E.g) Select Deptno.Deptno From DEPT_TABLE D) 15) Give output of below query Select Deptno.'' LocID From EMP_TABLE) E Intersect Select D.'' LocID From EMP_TABLE Intersect Select Deptno.Deptno From (Select Deptno.'' LocID From EMP_TABLE Note: No System help required for the above question 13) Use above table and tell the answer (NO System required…. LocID From DEPT_TABLE Order By LocID Union Select Deptno.Deptno From DEPT_TABLE D 14) Use above table data and tell the answer Select * From EMP_TABLE Where DEPTNO NOT IN (Select E.'' LocID From EMP_TABLE) E Intersect Select D. LocID From DEPT_TABLE Union Select Deptno.Deptno From (Select Deptno. Write a query to display the last name and hire date of any employee in the same . LocID From DEPT_TABLE Union Select Deptno. LocID From DEPT_TABLE Union Select Deptno.'' LocID From EMP_TABLE Order By DEPTNo 16) Tell the execution hierarchy of below query SELECT * FROM SUPPLIER_GOOD UNION (SELECT * FROM SUPPLIER_TEST MINUS SELECT * FROM SUPPLIER). LocID From DEPT_TABLE h) Select Deptno.

46. Write a query that displays the employee numbers and last names of all employees who work in a department with any employee whose last name contains a ‘u’. Display last name.and salary of any employee who earns a commission. 57. last name. Create a query to display the last name. Display the department number. Name the query as summary.department id and the average salary for the department. last name and department id of those employees who live in cities whose name begin with ‘T’. department number. Display the last name.Display the details of the employee id.(last name is Zlotkey) 42. hire date and salary for all employees who have the same salary and commission as Kochhar. 53. Use aliases for the columns retrieved by the query. department name and salary of any employee whose salary and commission match the salary and commission of any employee located in location id 1700. 45. and salaries of all employees who earn more than the average salary and who work in a department with any employee with a u in their name. Display the last name. Find all employees who are not supervisors using NOT EXISTS Operator 55. Exclude Zlotkey. Write a query to find all employees who earn more than the average salary in their departments. 54. and job ID of all employees whose department location ID is 2700. last names. 44. and job ID for every employee in the Executive department. 48.Sort the results on salary from highest to lowest. Display the last name and salary of every employee who reports to King. Display the employee numbers. salary . Show the department number and the lowest salary of the department with the highest average salary. Create a query to display the employees who earn a salary greater the salary of all the sales managers(SA_MAN).department as Zlotkey. Write a query to display the department names of those departments whose total salary is above (1/8) of the total salary cost to the whole company. Write a query to display the last names of the employees who have one or more co workers in their departments with later hire dates but higher salaries. 52. 43. Create a query to display the employee numbers and last names of all employees who earn more than the average salary. 51. Sort by average salary. . 50. department number. 49. Sort the results in descending order of salary. 56. 47. Write a query to display the last name.

Write a query to display the employee id and last names of the employees who work in the state of California. Display the country ID and the name of the countries. regardless of whether or not they belong to a department • Department ID and department name of all departments from the DEPARTMENTS table. 5) The HR department needs a report with the following specifications: • Last name and department ID of all employees from the EMPLOYEES table. regardless of whether or not they have employees working in them Write a compound query to accomplish this. Write a query to display the top three earners in the employees table. 6) Create a report for HR that displays the department number. 2) The HR department needs a list of countries that have no departments located in them. Sort the results in order of ascending salary 5) Create a report for HR that displays the last name and salary of every employee who reports to King. names. but have now gone back to doing their original job). 60. and locations of the departments where no sales representatives work(SA_REP) 59. last name. Use the set operators to create this report. 2) Create a report that displays the employee number. 50. Display the job ID and department ID by using the set operators. Display their last names and salaries. 1. Use the set operators to create this report. in that order. 3) Produce a list of jobs for departments 10. they changed jobs. . 4) Create a report that lists the employee IDs and job IDs of those employees who currently have a job title that is the same as their job title when they were initially hired by the company (that is. The HR department needs a query that prompts the user for an employee last name. and 20. 1. and job ID for every employee in the Executive department 7) Create a report that displays a list of all employees whose salary is more than the salary of any employee from department 60. The query then displays the last name and hire date of any employee in the same department as the employee whose name they supply (excluding that employee). The HR department needs a list of department IDs for departments that do not contain the job ID ST_CLERK. Show the department numbers.58. and salary of all employees who earn more than the average salary. last name.

Sign up to vote on this title
UsefulNot useful