DENSE RANK FUNCTION MS SQLSERVER

create table tbemp120
(empno int,ename varchar(50),eadd varchar(50),esal int,edno int)
insert tbemp120 values(66,’vinay’,’pathankot’,42000,5)
insert tbemp120 values(2,’vinay’,’pathankot’,32000,10)
insert tbemp120 values(3,’vinay’,’pathankot’,522000,30)
insert tbemp120 values(4,’vinay’,’pathankot’,522000,20)
insert tbemp120 values(5,’vinay’,’pathankot’,42000,20)
insert tbemp120 values(6,’vinay’,’pathankot’,32000,30)
insert tbemp120 values(7,’vinay’,’pathankot’,32000,30)
select ROW_NUMBER()over(order by esal)’srno’,esal,eadd,ename from tbemp120
select Dense_RANK() over (order by esal)’drank’,esal,ename ,eadd from tbemp120
select NTILE(3) over (order by esal)’grp’,esal,ename,eadd,edno from tbemp120
select *from tbemp120
delete from tbemp120 where empno=8
drop table tbemp88
select *from tbemp120 order by empno
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s