TOP
*
Introduced in SQLSERVER 2005
* It
specifies the first 'n' rows of the query result that are to be retrieved
Top with Delete
Delete top(4) from emp
Top with Update
Update top(3) dept set sal=sal*0.9 where deptno=10
Top with
Percent
Select top (5) percent ename,sal from emp
Select top 5 percent * from emp
Top with Order
By
Select top 6 * from emp order by ename desc
Write a query to
find duplicate records
Select deptno,ename ,count(*) from emp group by deptno,ename
having count(*)>1
Write a query to
delete duplicate rows?
Delete TOP 1 from T1 where a=10 and b=20 and c=30
No comments:
Post a Comment