Set - 6

Question 16 :

Display the records between two range?

Answer :

select rownum, empno, ename from emp where rowid in (select rowid from emp where rownum <=&upto minus select rowid from emp where rownum<&Start);

Question 17 :

minvalue.sql Select the Nth lowest value from a table?

Answer :

select level, min('col_name') from my_table where level = '&n' connect by prior ('col_name') < 'col_name')
group by level;
Given a table called emp with the following columns:
-- id number
-- name varchar2(20)
-- sal number
-- For the second lowest salary:
-- select level, min(sal) from emp
-- where level=2
-- connect by prior sal < sal
-- group by level

Question 18 :

What is difference between Rename and Alias?

Answer :

Rename is a permanent name given to a table or column whereas Alias is a temporary name given to a table or column which do not exist once the SQL statement is executed.

Question 19 :

Difference between an implicit & an explicit cursor.?

Answer :

only one row. However,queries that return more than one row you must declare an explicit cursor or use a cursor FOR loop. Explicit cursor is a cursor in which the cursor name is explicitly assigned to a SELECT statement via the CURSOR...IS statement. An implicit cursor is used for all SQL statements Declare, Open, Fetch, Close. An explicit cursors are used to process multirow SELECT statements An implicit cursor is used to process INSERT, UPDATE, DELETE and single row SELECT. .INTO statements.

Question 20 :

What is a OUTER JOIN?

Answer :

Outer Join--Its a join condition used where you can query all the rows of one of the tables in the join condition even though they don't satisfy the join condition.