Hcl Technologies 3+ Experienced Sql server Questions

Answers were Sorted based on User's Feedback



Hcl Technologies 3+ Experienced Sql server Questions..

Answer / susmita

6. HOW TO FIND 6TH HIGHEST SALARY?




with ta
as
(
select distinct top 6 salary from tblemp order by salary desc
)
select min(salary) from ta

Is This Answer Correct ?    2 Yes 1 No

Hcl Technologies 3+ Experienced Sql server Questions..

Answer / basha

2)Dispaly all managers from table(Manager id is same as Empid)

select * from employee where empid in
(select distinct mgrid from employee)

Is This Answer Correct ?    0 Yes 0 No

Hcl Technologies 3+ Experienced Sql server Questions..

Answer / sahil chawla

Select MIN(s.salary) FROM
(SELECT salary FROM Employee ORDER BY salary DESC limit 6)s

Is This Answer Correct ?    0 Yes 0 No

Hcl Technologies 3+ Experienced Sql server Questions..

Answer / daisy

1) select all the Employees who does not have phone?

select * from employees where empid not in (select empid
from phone)

2)Dispaly all managers from table(Manager id is same as
Empid)

select * from employees emp where emp.employeeid = emp.mgrid

3)How to know How many tables contain Empno as a column in
database?

4)Find duplicate rows in a table or if we have table with
one column which
has many records which are not distinct. How to find out
the distinct
values from that column and number of times it's repeated?

select salary,count(salary) as Repeat from employees group
by salary having salary > 1

5) How to delete the rows which are duplicate?(Don't remove
both duplicate
records.)
WITH [T ORDERED BY ROWID] AS

(SELECT ROW_NUMBER() OVER (ORDER BY product_name ASC) AS
ROWID, * FROM product where product_name ='Scale')

DELETE FROM [T ORDERED BY ROWID] WHERE ROWID <> 1

6)How to find the 6th highest salary?

SELECT TOP 1 salary

FROM (

SELECT DISTINCT TOP 6 salary

FROM employee

ORDER BY salary DESC) a

ORDER BY salary

Is This Answer Correct ?    14 Yes 15 No

Hcl Technologies 3+ Experienced Sql server Questions..

Answer / kotesh

6)How to find the 6th highest salary?

select level,max(salary)
from employee
where level=6
connect by prior salary >salary
group by level;

Is This Answer Correct ?    7 Yes 8 No

Hcl Technologies 3+ Experienced Sql server Questions..

Answer / anil babu

How to find the 6th highest salary?


select s.salary from
(select ROW_NUMBER() over (order by salary desc) as sno,Empid,salary from tbl_Emp )s where sno=6

Is This Answer Correct ?    0 Yes 1 No

Hcl Technologies 3+ Experienced Sql server Questions..

Answer / sabarinathan

HOW TO FIND 6TH HIGHEST SALARY?

SELCT * FROM(
SELECT *,RANK() OVER(ORDER BY SALARY) RN FROM TBLSALARY) S
WHERE RN=6

Is This Answer Correct ?    1 Yes 2 No

Hcl Technologies 3+ Experienced Sql server Questions..

Answer / sabarinathan

How many tables contain Empno as a column in database?

select count(*) from database.sys.columns where name='comp_id'

Is This Answer Correct ?    1 Yes 2 No

Hcl Technologies 3+ Experienced Sql server Questions..

Answer / pasha

How to find sixth highest salary?

--count number of rows first

select count(salary) from employee

select salary from employee where salary=(select max(salary)
from (select top 6 salary from (select top 6 salary from
employee order by salary asc) b order by salary asc) c)

Is This Answer Correct ?    0 Yes 3 No

Hcl Technologies 3+ Experienced Sql server Questions..

Answer / noopur shrivastava

delete empid from employee e ,phone p where e.rowid !=
p.rowid;

Is This Answer Correct ?    8 Yes 16 No

Post New Answer

More Placement Papers Interview Questions

TCS January 25,27 2008

3 Answers   TCS,


27 Feb Chennai Paper of Infosys And Interview

2 Answers   Infosys,


Hi, Sir my name is Alka Singh I applied for HPCL in HR discipline. I need placement paper of last 2 yeras of HR and aptitude test, please help me.

0 Answers   HPCL,


HUGHES PLACEMENT PAPERS

1 Answers   Hughes,


TechMahindra Pattern & Interview {09/05/2007} {Bangalore}

3 Answers   Tech Mahindra,






Sampal paper for Information System officer in HPCL

64 Answers   CFV, HPCL, IB Intelligence Bureau, TCS, Vizag Steel,


idbi assistant manager

9 Answers   Idbi Bank,


Caritor placement papers ----------- placement paper 2

4 Answers   Capita, Caritor,


CTS Placement Paper sql-plsql

1 Answers   CTS,


itEANz Placement Paper

1 Answers   itEANz,


INFOSYS PLACEMENT PAPERS ----- Placement Paper 10

1 Answers   Infosys,


A frog wants to climb a pole which is 15 feet in height, frog can jump 3 feet every minute after which he rests for a minute where he slips down 2 feet. How much time will the frog take to reach the top of the pole?

0 Answers  


Categories