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
What is use of except clause? How does it differ from not in clause?
User wants only to display only pdf as export option in report manager. How to achieve this?
What is meant by indexing?
Is sql server difficult to learn?
What is an index in sql?
How much is a sql server license?
Write a Select Query to display title for each group of records, which are collected with Compute Clause? Like titlefield column-A column-B ..... ..... ..... Sum ... titlefield column-A column-B ..... ..... ..... Sum ...
What are indexes in ms sql server?
What is meant by dirty read?
what number files will a information contain in SQL Server? How many forms of information files exist in SQL Server? How many of those files can exist for a single database?
How you can get a list of all the table constraints in a database?
Explain concepts of analysis services?
Explain what are the different index configurations a table can have?
How to write a query with an inner join in ms sql server?
Can you tell me about the concept of ER diagrams?