Answer Posted / divya mahendra sikarwar
Execute queries:
CREATE TABLE dbo.Test1 (
[ID] [int] ,
[FirstName] [varchar](25),
[LastName] [varchar](25)
) ON [PRIMARY]
INSERT INTO Test1 VALUES(1, ‘Bob’,'Smith’)
INSERT INTO Test1 VALUES(2, ‘Dave’,'Jones’)
INSERT INTO Test1 VALUES(3, ‘Karen’,'White’)
INSERT INTO Test1 VALUES(1, ‘Bob’,'Smith’)
INSERT INTO Test1 VALUES(4, ‘Bobby’,'Smita’)
select identity(int,1,1) as SlNo,* into #temp from Test1
DELETE
FROM #temp
WHERE SlNo NOT IN
(
SELECT MAX(SlNo)
FROM #temp
GROUP BY ID,FirstName,lastname
)
drop table test1
select * into test1 from #temp
alter table test1 drop column SlNo
select * from test1 order by id
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Suppose you want to implement the one-to-many relationships while designing tables. How would you do it?
Tell me about joins in database system and explain each in detail.
Find nth lowest salary or get nth lowest salary?
Describe and explain about SQL native client?
what are the Prerequisites for Replication?
What are the different types of backups that exist?
Why people hate cursor?
Do you know what guidelines should be followed to help minimize deadlocks?
What is the sql server 2000 version number?
What does asynchronous call backs means?
What does REVERT do in SQL Server 2005?
What is the syntax to execute the sys.dm_db_missing_index_details? : sql server database administration
Explain user defined functions?
Can a trigger be created on a view?
What are the operating modes in which database mirroring runs?