1.Query for retrieving N highest paid employees FROM each Department. 2.

Query that will display the total no. of employees, and of that total the numb er who werehired in 1980, 1981, 1982, and 1983. 3.Query for listing Deptno, ename, sal, SUM(sal in that dept). 4.Matrix query to display the job, the salary for that job based on department n umber,andthe total salary for that job for all departments. 5.Nth Top Salary of all the employees. 6.Retrievingthe Nth row FROM a table. 7.Tree Query. 8.Eliminate duplicates rows in a table. 9.Displaying EVERY Nth row in a table. 10. Top N rows FROM a table. 11. COUNT/SUM RANGES of data values in a column. 12. For equal size ranges it might be easier to calculate it with DECODE(TRUNC(v alue/range),0, rate_0, 1, rate_1, ...). 13. Count different data values in a column. 14. Query to get the product of all the values of a column. 15. Query to display only the duplicate records in a table. 16. Query for getting the following output as many number of rows in the table. 17. Function for getting the Balance Value. 18. Function for getting the Element Value. 19. SELECT Query for counting No of words. 20. Function to check for a leap year. 21. Query for removing all non-numeric. 22. Query for translating a column values to INITCAP. 23. Function for displaying Rupees in Words. 24.Function for displaying Numbers in Words 25. Query for deleting alternate eve n rows FROM a table. 26. Query for deleting alternate odd rows FROM a table. 27. Procedure for sending Email. 28. Alternate Query for DECODE function. 29. Create table adding Constraint to a date field to SYSDATE or 3 months later. 30. Query to list all the suppliers who r supplying all the parts supplied by su pplier 'S2'. 31. Query to get the last Sunday of any month. 32. Query to get all those who have no children themselves. 33. Query to SELECT last N rows FROM a table. 34. SELECT with variables. 35. Query to get the DB Name. 36. Getting the current default schema. 37. Query to get all the column names of a particular table. 38. Spool only the query result to a file in SQLPLUS. 39. Query for getting the current SessionID. 40. Query to display rows FROM m to n. 41. Query to count no. Of columns in a table. 42. Procedure to increase the buffer length. 43. Inserting an & symbol in a Varchar2 column. 44. Removing Trailing blanks in a spooled file. 45. Samples for executing Dynamic SQL Statements. 46. Differences between SQL and MS-Access. 47. Query to display all the children, sub children of a parent. 48. Procedure to read/write data from/to a text file. 49. Query to display random number between any two given numbers. uery for retrieving N highest paid employees FROM each Department. 2.Query that will display the total no. of employees, and of that total the number who werehi red in 1980, 1981, 1982, and 1983. 3.Query for listing Deptno, ename, sal, SUM(s al in that dept). 4.Matrix query to display the job, the salary for that job bas ed on department number,andthe total salary for that job for all departments. 5. Nth Top Salary of all the employees. 6.Retrievingthe Nth row FROM a table.

Query to get all the column names of a particular table. Top N rows FROM a table. Query to count no. SELECT with variables. 20. Query for deleting alternate eve n rows FROM a table. Query to get the DB Name.. 22. 43. 39. 33. Getting the current default schema. Inserting an & symbol in a Varchar2 column. . Procedure to read/write data from/to a text file. SELECT Query for counting No of words. 37. 28.7. 41.Tree Query.Displaying EVERY Nth row in a table.Function for displaying Numbers in Words 25. 13. Count different data v alues in a column. 10. 19. 51. Query to display rows FROM m to n. Query for translating a column values to INITCAP. 11. sub children of a parent. 16. 24. Create table adding Constraint to a date field to SYSDATE or 3 months later. Query to get the last Sunday of any month.Table comparison 61. Function for displaying Rupees in Words. Query to list all the suppliers who r supplying all the parts supplied by su pplier 'S2'. Function to check for a leap year. Query to get the product of all the values of a column. 32.Double quoting a Single quoted String 59. 48.. 18. 40. rate_1. 46. 27. Query for getting the following output as many number of rows in the table. Query for deleting alternate odd rows FROM a table. Query for getting the current SessionID.Time Conversion 60. Columns of a table 55. 49. 38.Change Settings 58. 42. 35. 9. Function for getting the Balance Value. To convert signed number to number in oracle 54. For equal size ranges it might be easier to calculate it with DECODE(TRUNC(value/range). Procedure to increase the buffer length. 34. 26. Alternate Query for DECODE function. Differences between SQL and MS-Access. 50. View procedure code 53. Query to display all the children. Delete rows conditionally 56. 45.). Procedure for sending Email. Removing Trailing blanks in a spooled file.CLOB to Char 57.Running Jobs 62. 23.0. 47. 8. Spool only the query result to a file in SQLPLUS.Eliminate duplicates rows in a table. COUNT/SUM RANGES of data values in a column. rate_0. 36. 30. Samples for executing Dynamic SQL Statements.First date of the year . Using INSTR and SUBSTR 52. Time difference between two date columns. 29. Query to get all those who have no children themselves. 12.Switching Columns 63. 21. Of columns in a table. 31. Query to display only the duplicate records in a table. Query for removing all non-numeric. 17. Function for getting the Element Value. Query to SELECT last N rows FROM a table. 15. 14. 44. 1.Replace and Round 64. Query to display random number between any two given numbers.

Total 1980 1981 1982 1983 ----------.-----------. 69. 1982. 'YYYY'). 72. Concatenate a column value with multiple rows. Query that will display the total no. sal FROM emp e WHERE 2 > ( SELECT COUNT(e1.---------.sal < e1. COUNT (DECODE (TO_CHAR (hiredate. empno)) "1983" . empno. of employees. empno)) "1982". 70.3 DESC. COUNT (DECODE (TO_CHAR (hiredate. Create Query to restrict the user to a single row.sal ) ORDER BY 1. 2. 'YYYY').Cursors 67. and 1983. empno)) "1980". Give appropriate column headin gs. 'YYYY'). 1981. We need to stick to this format.Create Sequence 66.-----------.14 1 10 2 1 SELECT COUNT (*). empno)) "19 81". and of that total the num ber who were hired in 1980. The following query retrieves "2" highest paid employees FROM each Department : SELECT deptno. I am looking at the following output. Query to delete all the tables at once.deptno AND e.sal) FROM emp e1 WHERE e. 'YYYY'). '1981'. 1. Query to get the first inserted record FROM a table. 71.65.COUNT(DECODE(TO_CHAR (hiredate. '1983'. '1982'. COUNT (D ECODE (TO_CHAR (hiredate.Current Week 68. SQL Query for getting Orphan Records.'1980' .deptno = e1.------------.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.