Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft SQL Server > Re: The Sql ran...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 7 Topic 10981 of 11517
Post > Topic >>

Re: The Sql ranking OVERture

by Ed Murphy <emurphy42@[EMAIL PROTECTED] > Apr 20, 2008 at 09:22 PM

steve wrote:

> Given the idea that Rank is a primary concept I'm suggesting that it's
> understandable based on more primitive ones. One of which a cursor
> (type). It's where the order in the ranking comes from. Rather than
> shoehorning it in it seems to be a case of - if the shoe fits wear
> it :) I'm not sure I understand your suggestion of introducing
> complexity. . The idea of a cursor seems very basic. One of the themes
> of a relational database is to simplify understanding. That's what I
> was trying to do though I'm not sure I succeeded:) Behind every
> function is an idea. Ranking is no exception.

Replacing this:

  select c1, c2, rank() over (order by c1) r
  from t
  order by c1, c2

with this:

  select ToTable(
    ToList(
      cursor(t order by c1)
    )
  )
  order by c1, c2

is hardly a simplification.

>> But this is arguably not a rank; it's an understandable concept, but it
>> deserves a different name.  More to the point, it deserves a practical
>> example in which you would actually want to do something like this; I
>> can't think of one offhand.
> 
> I'm taking the position that a rose is a rose is a rose. Because the
> data doesn't fit within the parameters of the dense rank function is
> that reason to call it something else? :)

I suppose it's a rank over something that isn't a simple ORDER BY.  I
still can't think of a practical situation where you'd actually want
this, though, and this:

> You may find this post interesting on the subject:
> 
> microsoft.public.sqlserver.programming
> Oct 30 2007
> 'Count Occurances in Select Statement'
> http://www.themssforum.com/SQLServerDev/Count-Occurances-726289/

is an equally artificial example and thus doesn't help.

Assuming that such a practical situation does exist and I just don't
know that it is (i.e. that Josh is not a sock puppet of yours), I
would still prefer to see it expressed without explicit reference to
a cursor:

  select c1, c2, c3, rank() over (order by c1, change(c2)) r
  from t
  order by c1, c2, c3

Some of your ideas (this one among them) strike me as analogous to
CISC, which has been largely superseded by RISC for a reason:  making
common simple cases harder in return for making uncommon complex cases
easier is generally not a net win.
 




 7 Posts in Topic:
The Sql ranking OVERture
steve <rog11228@[EMAIL  2008-04-19 21:59:12 
Re: The Sql ranking OVERture
Ed Murphy <emurphy42@[  2008-04-20 15:49:11 
Re: The Sql ranking OVERture
steve <rog11228@[EMAIL  2008-04-20 19:18:18 
Re: The Sql ranking OVERture
Ed Murphy <emurphy42@[  2008-04-20 21:22:44 
Re: The Sql ranking OVERture
steve <rog11228@[EMAIL  2008-04-21 17:52:23 
Re: The Sql ranking OVERture
B D Jensen <bjorn.d.je  2008-04-23 06:42:48 
Re: The Sql ranking OVERture
steve <rog11228@[EMAIL  2008-04-23 15:55:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 22:10:02 CST 2008.