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

chemical engineering

2 Answers   CPCL, Omega Sea,


HUGHES PLACEMENT PAPER -------- Placement Paper

1 Answers   Hughes,


Tcs Technical, Managerial , HR Interview Rounds --- -26Nov 2006 Hyd

1 Answers   TCS,


A Successful Mastek Interview 5 Apr 2007 Bhuwaneswar

1 Answers   Mastek,


ANPh9

1 Answers  






placement paper of hpcl

29 Answers   HCL, HPCL,


JINDAL PLACEMENT PAPERS

1 Answers   Jindal,


analytical ability,numerical ability,numberseries,letter series,abstract reasoning,sentence completion

1 Answers   HCL,


CSC Aptitude Placement Paper 25 Mar 2007

4 Answers   CSC,


Robert Bosch Mechanical Engineering Paper --- Bangalore 14 November

1 Answers   Bosch,


itEANz Placement Paper

1 Answers   itEANz,


banking related inteview question?

0 Answers   Banking,


Categories