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

what is placement paper?

2157


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

790


what is difference between uv and visible spectroscopy and how to differentiate the drug compounds in uv visible region

1603


Do we have vacancy for HR RECRUITER ?

1392


Zero setting of sejong rottary press

1201






What kind of Issues/bugs arise in ETL projects? I would like to know few issues (critical to somewhat bugs ) normally occur in ETL process especially when testing? Domains can be banking, retail or any.

1427


how did you celebrate your last birthday?

1281


aptitude

705


what is the use of air in gc

1444


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

1200


Danlaw placement questions and answers

1359


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

1403


HI SIR I WANT PREVIOUS QUESTION PAPER OF HPCL I M CHEMICAL ENGG.

1951


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?

609


Hi.. Guys Im pranitha, presently im working in a organisation & im look for job at MNC's like DELL, Delloitte, Bank of America, Genpect, etc., I have completed B.com . Pls help me...

1152