|
Posted by Doug on 01/30/06 18:10
Hello,
Good discussions.
>>ordering in an RDBMS, so "first", "next" and "last" are totally
> >meaningless.
>> Really? To me, first, next, and last do have meanings in an RDBMS,
><> assuming you have an order.
>Celko can be a bit of a curmudgeon and hates to admit when he's wrong. But
here he's right.
>You do not have a defined order in a table.
Hmmmm. I said you CAN define the order that data is retrieved from a
table. celko says you can't. Obviously everyone knows that the table is
not stored in any particular order. That is a misperception from old
timers from the 70's, but most have figured it out by now.
> >You must use an ORDER BY clause on a
> cursor.
> Really? I didn't see that anywhere. I've used cursors all the time
> without an order by function.
> my bad.
>Yes it is. You may be able to loop through the cursor set, but each time
you call that cursor you cannot guarantee the order the results will be
returned in w/o an ORDER by statement. Yes, it may seem that you
always get
the same order, but that's just an indirect result of the optimizer and
can
change.
hmmm. i use cursors all the time without order. When I do this, I don't
care about the order. There is nothing that says you HAVE to use a
cursor with an order.
Come to think of it, it is very rare that I use a cursor with an order.
I sometimes order the results though.
>What defines "first" here though? First in this case is the first one that
the optimizer happens to return. That can chang from call to call.
(of
course this particular example is pointless snice if fieldname is NULL
you
might as well just say select NULL
Read the code again. As i read it, he wanted to know if a key name
existed where something was null. Yes, you can use "exists", but that
can be REALLY slow.
Using "first" with or without an order is a valid method of checking
for the existance fo something. It is an efficient method, and it
solves business problems.
I believe celko is an arrogant, pompous individual who is not nearly as
smart as he thinks he is. if he were somewhat smarter, he would be able
to help people instead of belittling and confusing them.
a goal on these groups is to help and get help. i believe he
intereferes with that.
Navigation:
[Reply to this message]
|