知方可补不足~row_number,rank,dense_rank,ntile排名函数的用法

时间:2022-07-03 18:04:07

回到目录

这篇文章介绍SQL中4个很有意思的函数,我称它的行标函数,它们是row_number,rank,dense_rank和ntile,下面分别进行介绍。

一  row_number:它为数据表加一个叫“行标示”的列,它在数据表中是连续的,我们必须按着某个顺序把表排序之后,才能使用row_number,看下列例子:

SELECT   row_number() OVER ( ORDER BY SalePrice ) AS row ,
*
FROM Product

结果表被加上了行号:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnMAAABfCAIAAAAMI9Y9AAAU1UlEQVR4nO1dO27zOhPlhmykTvVtwYCzhfQu/LvNDpIiuNlEulx4DSmDi6/LYvgX1IPiS8P3jDQHRKDIFHWGw+ERKYkSf3++X15e/jAYDAaDwSgBMSmrrIaqhTcovx7oMk/D3uylAup+oc5foZcVqGoPFRkgnJwXyvr357t40mWbYvn1El3mbO+WEnW/UOff1wpUtYeKTCZnVlZ0Ltlq2pu9VBJ1v1Dn39cKVLWHikwmZ1ZWdC7ZatqbvVQSdb9Q59/XClS1h4pMJuftKuvX5UHMeHoHl/l1eThe7rFMpqPA50XEXBxuX3mF5Hjq5/t+PaTYC7UuqTJ3k0IRqtWeu+qCraWiW2H8TQLhtu35tbMVfs4f5wKU/LX3+iROH95/Aalgl/iT1xRrdgK7VNapoqPUAp7ZeYrF4Z+3o9eRiJgLIdLOWMJT9+thPvvP61Ns04/oLv3uqGY1/hTsW8dLrq/Lg7Nj9ddbrlvBroloV9fLw/Fy9xXo2t/dCv+B8VIX7f1yyprZJeY1xVCPmh34+1bWqGZRUllDpaFifjuPzb21sn7ejtqIOSFFDURietWdpITREiBPtlvBNCLaVfSYtbsV1Vtsc2XN7xLjazi5R82owE7K+nV5OJ6ejkKI08c8VD99/Hz/fT8NG3MVaBcsac74mq5VPSf9Wc4YGBe28/br0zyl8Hk7jpkDzcjvSFzMLf5qrmk5k6Y4iIfr623Y+FwSCHVD/pZgxYPb3qHwJTHLFoOJxx1xhWw6+f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RO3Vh5fM3IWPSo/GlQnK+nk7Hp7OiZ+Qgynrr/o8eS1lHcvF9sUohbCy+tTRyLBaQnjbPp3xtyAgV+WD0/grcvwVOTCo81eIvTdUKoqpjFlHjN06GlfGK+v7SZxfkz/OClLW+7NYfnq6iGEjpoKxBdGA2FjS/9VV1qe+8Jg0DumnrMOYNe3L53opOR8zj8rsOnw4sELmCBr85fMR2Pkr5CtrWhQTU1Z7Vqu3K2OV9fVJnD4yPnsOUFZHn1LEsBnDfAaqCJoRYO4MEgm4aDUKWZ1H0nPK3so6fdyYuLKiyMzKOgI7f4Wc2WA9p9yusqruXLHB48o4ZZ0EtZ6y6je1Ks8GYwuiAauzweGIKjVm1QOyo7JOsipTlXV4omE5C+I7PCqzTpKVFVJmS1Dnr5A5Zk2OYkLKKqUETGu1RpSyft6Oi546TVyDyjrdHh+QXDWryi17V70Pq83IeVka+BWY2d42xLi9suqyKmXUvU++z8r3WWnzV8hR1pwopqasq49itEbsbLA5eK0wGzyg1ph1fpzsd374FBPgyhoehgbGrD74TiSryaoMe8rwj3e+AaasEYdnZw5MjfTNDJ6ziehbUc4DUeevUGQ22NiGRDEJZf0FvT7QB/tTVjQvPPkQYD4FRiCinHLr2w8f/rZX1tlNQohx9sLjO5iyRhxeILO1x5pz7pMZ2v6j+laEMUWdv0LsmDX8KzyKSSir1Bw3iQUSVyYqa07iNZjCgMRS4CexNmYNl+krSt+ARCYcdD21bVD3C3X+ChArakQxqtpDRQYIVlZ0iGJuS6YdSM5/jRKcAuyMQJ9IJ4Oup7YN6n6hzl8BaEXxKEZVe6jIAMHKig50madhb/ZSAXW/UOev0MsKVLWHigwQ68r6UgGsrAHQZZ6GvdlLBdT9Qp2/AiurREYGiBVl/VMNrKw+0GWehr3ZSwXU/UKdvwIrq0RGBgib8/8BwNl3h7CA3ZkAAAAASUVORK5CYII=" alt="" />

这个row_number在平常用的最多,它可以用来实现数据表的分页功能,看下面代码

 SELECT *
FROM ( SELECT row_number() OVER ( ORDER BY SalePrice ) AS row ,
*
FROM Product
) AS Result
WHERE Result.row BETWEEN 1 AND 2

它的含义是从第一条记录开始,取出2条记录,如果你想一页显示10条记录,可以使用BETWEEN 1 AND 10,如果想得到第二次的10条,那条件就变成BETWEEN 11 AND 20

二   rank:类型于row_number,不同之处在于,它会对order by 的字段进行处理,如果这个字段值相同,那么,行号保持不变,如代码:

 SELECT RANK() OVER ( ORDER BY SalePrice ) AS row ,
SalePrice ,
ProductID ,
ProductName
FROM Product

结果如下:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQUAAABfCAIAAABulkXjAAAKM0lEQVR4nO1dQZLCKhPmQlquZzVXsEqv4N6Fv9u5gbOwnpdw56ucYZbWK3dzGP4FMSGBbpqQZmjlK2oqExE+ob90EyBRWuvH/Wf29PX19fn5qbUWWn7l/BrMY5MSaq8Se0giZ+nMY9Mr6uG2X6kW27Pv67f9arlvvCVb3wW/PjvnyZUiP4TyLXK9BTFXi+MtrRA0vZ4eTtuuyW77lVpfojrD/miULbn1MauCKsUTPbO3isHXr8claNAFMVdKTauRll5OD5Q2Iurhftp65cTLOabSOfWAlVYU8+PmqVvxerjtV8v1dqmUWl96V7u+3H8e53V70DerdaWn99D9elyq1eFqn7xshj7dEzBYLmVkNz3n7sp02o4iBLecyVY1rtRpqEF1SrWZ3UumTfJ6tPlDeoANuizmDn9f/7Zdtjqcju3BldJT2fXQ8ui9c3NYqM3pcb8el4vjzQhjaLVxemgL9//mQYM+a7x7FfL8ese5/1YXVxjF+sqJtSqoUn9DPQmc14BVOSTPBP9gN0jZzC8bwEK6/gX7LtBT+f2D0xPDH3nZLI7n/WpzepzXo8s8WQ/PZBr9DlyWhmNBNWg4p4nHWoJsAnMRETEe0lCxZ9wqmPxDTub303bkKLxux+27UE8VpIfHeb067LfLfXM/bZf7y2Ex5Y7HIJkOHo6wB3pwun+iHkhxc3FWNfP4IacefprDYrVZr4y1ePvX23ehnvojPXicqTHfNs67bKygM6aHrNI6/2Bd9gZu2nLN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7hewyBxDwxSvrv0ofz1Gt1LIAtczKdp6zXcSTREA5ONHqqO8itwwHq47Vec65e0bvufRQ/uftTy1/P1q/gK3SkXvLpRjNgrGPwjBUxs6xiHQwSkh+txudhuJi72pumh3QDD5B/sWr5/Jaz3tnRa5nsg8NaGbHqUIVgCfuxWN/qbCEAP57XanCZvfiDpodmpXZN4rQ7rwX2cwF87CJhzx6tMOUwZP4wCG/vY1QxdD6OvcOuhfawGpx7aLmfVg70fVYIeugFEicGSJo8f3H/dY6iQYLxk59R59NDJgE8PnUWy+wc5zxMoZ4QDIRgv4dY8l3+wxZBBD9fjcsCVYb9odx+lBcd+UbsyEc+bKUexEIKtjQQ23k+Jmd3jzPHS2FGwjB+01mz+QeTzyPq7SiL3i+rQllGKf8A9jFuUnlUM+lX1oH37UcuffyiEIYTg+AG3Zq9IoPN0V5NPDympzk9DkMjZAGKO2GKUf8DLhIqyD9JVUfWQGxI5G0Qxdw096B+8JXhl47V+SFpRqHrIDYmcDeQyp6PuF80NiZwN5DKno+4XzQ2JnA3kMqej7hetqaY+MS4lr6gQh6qHiooe/wcIHQZlvLhJYgAAAABJRU5ErkJggg==" alt="" />

三   dense_rank:与rank类型,不同之处在于行号是否保留一个位置,rank对保留这个位置,即上面图中,row的值由1直接变为3,因为它的1出现了两次,所以为2保留了一个位置,而dense_rank不会保留2这个位置,即实现的行号2其实是排在了第3位,如代码:

 SELECT DENSE_RANK() OVER ( ORDER BY SalePrice ) AS row ,
SalePrice ,
ProductID ,
ProductName
FROM Product

结果如下:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQYAAABiCAIAAAA9ReqTAAALuUlEQVR4nO1dsW4buRblx6QLJKhJ8YwA8S8IK+UP4iLNQsBqhTRBqjTBs1zowX+QRg4QwIG6lAlcBYKh4gGu9hPcG+AWlEYc8vLOJWfI4VV4QBjjEefyDHnOkNRwNEJGwPn5eYywyeLHAEfOCnyZh0Hstnfdpg8fPlSV2HnwBPEL59NgHpyKJVIkjp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osO+vITYI1r2rOMpZEAFZ4nY2irbGSXuCrNWyVI/4+S/7Oy72y/T5usb+jaJj0DP4R8Jx21v6dDu+sC1xsxgOppPAleE+A6dWAvWIn//icK0m8nzPBF7bLlkbGRoj4Nt2ccbfrmBZYjUWk2XwwxIelmi3DpoeP/9HiDReeToiZC5hjHD0bds2dEsYhySwxP6HOWJbQg2dI80ljPgcLFFNJnIcNUnyXML+1952BWkcOOk5ZTJLVE5I0UuUnyOokM1sx4XGgRMu6K56Cd0PaSxxsxjW6MZ8V52U5UdrDsjHtC401jYywgE/JWa2t9MPnMzuonNLlJ82A3D8nonlg6ay6VlTSi+B9zN2KBnHDzK9JaR2l6CNPL3i539fIhOGLjTOJXBBgz5x7ad3OEkt0SaVu9cucOSs4GKOyNGrl8BjukLpGx0ao1giHThyVvBibmu9sZcAI4DOAQ3gclcYiiXSgSNnBb7MA1AeNE0HjpwV+DIPQHnQNB04clbgyzwA5UHTkkqqpRQL0AsKGKFYoqCghmKJgoIa/gXRsoBSfY6vlAAAAABJRU5ErkJggg==" alt="" />

四   ntile:为装桶操作,ntile(桶数)它在运行之前,先确定产生的桶数,然后根据桶数去生成行标,如代码:

 SELECT NTILE(1) OVER ( ORDER BY SalePrice ) AS ntile ,
SalePrice ,
ProductID ,
ProductName
FROM Product

结果如下:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQkAAABZCAIAAACi80ZwAAAJb0lEQVR4nO1dO27rOhDlhmy4TuUtGHC24N6Fn1vvICmCm02484XXkNK4SJfF8BXUhxLJITX8zTg8IAJFosUjco5mKJKSkHmw3W4znbl8KWnBkbMCX+Y4iO/HV/J0uVyGesxx/pKlNM7cmaNT00bRxJEzd+bo1LRRNHHkzJ05OlHSxu24WR/vSUq5HTeiw+vHwrK03zp/nrxm0IUurLT5r4LLJcRcrM63uJOEpara0Ftofbwn08bb61B9t+NG7D4XNYx+aJYtuiUgC3MVCqfwzNYiJj+/ntdO4ybEXAiBK3FhoqEN1HUGtRaiY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JwAAAABJRU5ErkJggg==" alt="" />

当我们面对一个复杂的问题时,考验的不是你是否能解决,而是你采取哪种方式去解决以及代码的性能问题。

回到目录