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

ICICI Placement Paper - 2006

2 Answers   ICICI,


Tcs Freshers Interview On 27 jan 2007 In Hyderabad.

1 Answers   TCS,


IBM MAINFRAMES CICS PRE-ASSESSMENT QUESTION PAPER

1 Answers   IBM,


THINKSOFT PLACEMENT PAPER

4 Answers   Thinksoft,


ONMOBILE PLACEMENT PAPERS

2 Answers   OnMobile,






placement paper of hpcl

29 Answers   HCL, HPCL,


Recent Patterrn Of Sonata Software

1 Answers   Sonata,


CitiCorp Placement Papers -------------placement paper 2

2 Answers   CitiGroup,


Recent Value Labs Pattern And Interview I Faced

2 Answers   Value Labs,


icici

1 Answers   HDFC, ICICI,


U.S.Technology Slection Procedure And Interview 30 Jan 2007 Placement Paper

3 Answers  


NEW BRANCH OPEN IN VIDARBHA { MAHARASTA}

1 Answers   Taj Group,


Categories