Hcl Technologies 3+ Experienced Sql server Questions

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

your project to describe and tell about : 1. My favorite things 2. My favorite places at home 3. Animals *Choose one of them to describe *Write on your paper *If you done, Send me *Did you get it

784


Recently conducted Apptitude test

1409


Danlaw placement questions and answers

1354


Do we have vacancy for HR RECRUITER ?

1379


what is placement paper?

2151






If anybody knows the recruitment procedure of IOTL & POWER MECHANICAL. send me the placement papers if u hav... very urgent ...

3894


why didn't get placed so far?

1192


printf("%d",printf("%d",printf("%d",printf("%s","ILOVECPROGRAM")))); whats the output

1394


What were the occupations of the people who lived within the Mauryan Empire?

581


speak 1min on topic Travelling,memorable moment ,memorable day?

1738


i want the sample placement paper of goldman sachs urgently. please send it to me

3926


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?

600


what you will do when you struck in traffic ?

1051


my question is : reverse a string in COBOL program (please write a code asap) input file: 1234abcdef abc*$#1___ cdef____ghi a_z_k_h___ 4_3_2_1___ ______5678 output file: 8765_____ 1_2_3_4__ h_k_z_a__ ihg____ghi 1#$*cba__ fedcb4321

1194


Zero setting of sejong rottary press

1198