MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Consider the below emp table with the data.EMPNO ENAME DEPTNO7369 SMITH 207499 ALLEN 307654 MARTIN 307839 KING 107900 ALLEN 30What is the output of the following query?SELECT ename FROM emp WHERE ename = (SELECT MIN(ename) FROM emp);
A
ename ____ ALLEN
B
ALLEN
C
Error
D
None of the above
Explanation: 

Detailed explanation-1: -having count() = (select max(count(*) ) from emp group by deptno); Display the emps whose manager name is jones. A) select * from emp where mgr in (select empno from emp where ename = ‘JONES’); (OR) B) select * from emp where mgr = (select empno from emp where ename = ‘JONES’);

Detailed explanation-2: -Here is a way to do this task using dense rank() function. Query : select * from( select ename, sal, dense rank() over(order by sal desc)r from Employee) where r=&n; To find to the 2nd highest sal set n = 2 To find 3rd highest sal set n = 3 and so on.

Detailed explanation-3: -Which of the below SELECT statement is used to select all columns of EMP table? Answer: C. The character ‘*’ is used to select all the columns of the table.

Detailed explanation-4: -Select the table EMPLOYEES. In the right frame of the Oracle SQL Developer window, in the Columns pane, a list of all columns of this table appears. To the right of each column are its properties-name, data type, and so on. (To see all column properties, move the horizontal scroll bar to the right.)

There is 1 question to complete.