Professional Documents
Culture Documents
SQL Interview Questions - 1
SQL Interview Questions - 1
3) Query to display employee details who are getting max salary in each department from emp
table?
sql> select * from emp where (deptno, sal) in ( select deptno, max(sal) from emp group by deptno);
5) Query to display first row and last row from emp table?
sql> select * from ( select rownum r, ename, sal from emp) where r=1 or r= ( select count(*) from
emp);
10) Query to display first five highest salary employees from from emp table?
sql> select * from ( select * from emp order by sal desc ) where rownum<=5;
12) Query to display 2nd, 3rd, 4th, 5th, 7th, 9th row from emp table?
sql> select * from ( select rownum r, ename, sal from emp)
where r in (2,3,4,5,7,9);
Interview questions for experienced PLSQL Developers
LONG
1) It can store up to 2GB data.
2) Table can have only one long column.
3) Subquery can not select a LONG datatype.
4) LONG datatype does not work with regular expressions.
LOB
1) It can store up to 4GB data.
2) Table can have more than one LOB columns.
3) Subquery can select LOB column.
4) CLOB datatype work with regular expressions.
1) There could have lot of DML's would have happened recently. Hence statistics might be outdated.
Since oracle engine generates the explain plan based on the available statistics information chances
are there that it might comes with wrong execution plan because of the outdated statistics.
2) Because of the lot of DML operations chances are there that data in the underlying tables would
have drastically changed which might impact on the access path.
e.g. Till yesterday it was using index for access tables but suddenly from today because of the huge
volume of the data or because of huge drastic changes in data it started using full table scan.
3) Chances are there that indexes on underlying base tables have been dropped.
4) Any database parameter have modified recently because few database parameters have direct
impact over execution of the query.
5) We need to check whether any background process is running at the time of query execution.
6) Is there any scheduled job which is executing in the system where database is installed. This will
affect performance of overall database activity.
7) Chances are there that suddenly huge increase in number of online users to the application which
will increase in number of transaction in the database which will impact query performance.
8) We need to check is there any version is upgraded or any data migration activity is happen.