-
Maxvalue.sql Select the Nth Highest value from a table
select level, max('col_name') from my_table where level = '&n' connect by prior ('col_name') >'col_name')group by level;Example:Given a table called emp with the following columns:-- id number-- name varchar2(20)-- sal number---- For the second highest salary:-- select level, max(sal) from emp-- where level=2-- connect by prior sal > sal-- group by level
-
What are cursor attributes?
%ROWCOUNT%NOTFOUND%FOUND%ISOPEN
-
What is a cursor for loop?
Cursor For Loop is a loop where oracle implicitly declares a loop variable, the loop index that of the same record type as the cursor's record.
-
How will you delete duplicating rows from a base table?
Delete from table_name where rowid not in (select max(rowid) from table group by duplicate_values_field_name); ordelete duplicate_values_field_name dv from table_name ta where rowid <(select min(rowid) from table_name tb where ta.dv=tb.dv);
-
-
-
Average Monthly Salary
Write a query to display the average, monthly salary bill for each job type within a department.
-
Department Wise Average Salary
How to query the average salary for all the departments employing more than 3 people?
-
-
-
Co-Related Sub Query
What are the disadvantages of co-related sub query?
-
Display time with sysdate
How to display time with sysdate?
-
Ref Cursors
How many ref cursors can be dynamically opened in stored procedures for a session?
-
Variable Length Record
Describe variable length record representation in files using byte string representation
-
SQL Soundx
What is soundx in SQL?
-
-
-
SELECT Statement in CASE
How to use select statement in Case?
-
How you will avoid your query from using indexes?
SELECT * FROM empWhere emp_no+' '=12345;i.e you have to concatenate the column name with space within codes in the where condition.SELECT /*+ FULL(a) */ ename, emp_no from empwhere emp_no=1234;i.e using HINTS
-
Oracle SQL Interview Questions
Ans