November 30, 2010 at 2:37 pm
Trey Staker (11/30/2010)
It kind of makes my head spin.
Yep, mine is spinning around 3 axes. ๐ :hehe: ๐ :hehe: :w00t: :hehe: :sick:
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
November 30, 2010 at 2:39 pm
GilaMonster (11/30/2010)
Joe's pulled out his usual example over here: http://www.sqlservercentral.com/Forums/Topic1026791-392-1.aspx (please don't take that thread out of control. So far it's polite)Before I reply to his assertions, I'd like an opinion here.
If you had to write a query with this kind of 'join', would you be happy with the design of that database?
SELECT ..
FROM T1, T2, T3
WHERE T1.a BETWEEN T2.b AND T3.c;
Honestly, if that was the only 'join' between three tables I'd be seriously questioning the design of the DB and intent of the query.
If it were written:
SELECT ..
FROM T1
inner join T2
on T1.a >= T2.b
inner join T3
on T1.a <= T3.c;
Would you still question it? It's the same query, but it looks "more usual".
I guess I'd be curious either way, but the tables may work that way. I'd have to have more of an actual structure before I'd consider it seriously "weird".
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
November 30, 2010 at 2:41 pm
GilaMonster (11/30/2010)
Joe's pulled out his usual example over here: http://www.sqlservercentral.com/Forums/Topic1026791-392-1.aspx (please don't take that thread out of control. So far it's polite)Before I reply to his assertions, I'd like an opinion here.
If you had to write a query with this kind of 'join', would you be happy with the design of that database?
SELECT ..
FROM T1, T2, T3
WHERE T1.a BETWEEN T2.b AND T3.c;
Honestly, if that was the only 'join' between three tables I'd be seriously questioning the design of the DB and intent of the query.
I would question it.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
November 30, 2010 at 2:47 pm
Trey Staker (11/30/2010)
It kind of makes my head spin.
Yup. Far too late on a Tues evening to be thinking about relational theory.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 30, 2010 at 2:51 pm
GilaMonster (11/30/2010)
Trey Staker (11/30/2010)
It kind of makes my head spin.Yup. Far too late on a Tues evening to be thinking about relational theory.
Gus' example slowed the spinning down a bit but still...
I did something years and years ago self joining a table on an key field that looked similar to what Gus wrote. I can't remember why or what I actually accomplished with it but I'm sure it was to get around a poorly designed 3rd party database and something to do with ranges of numbers. I had a boss back then who had been in technology a long time and would joke that he forgot more about IT than I had learned up to that point in my career...I think I'm now in his shoes.
---------------------------------------------------------------------
Use Full Links:
KB Article from Microsoft on how to ask a question on a Forum
November 30, 2010 at 2:55 pm
GSquared (11/30/2010)
If it were written:
SELECT ..
FROM T1
inner join T2
on T1.a >= T2.b
inner join T3
on T1.a <= T3.c;
Would you still question it? It's the same query, but it looks "more usual".
Yes, I would. There'd have to be a really good reason for a query to need two triangular joins (and nothing else). It has the smell of someone trying to be 'smart' and 'clever' with database design.
Yeah, there are likely legit reasons for this, but not common ones.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 30, 2010 at 2:57 pm
I posted a possible real-world example as a reply in the original thread with the weird join. I think it would be a legit use of either query structure, but the Celko one is marginally more intuitive in the case I posited. Take a look there, reply there if you think I'm crazy. (Of course, everyone on The Thread already knows I'm crazy, but that's a different subject.)
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
November 30, 2010 at 2:58 pm
Trey Staker (11/30/2010)
I did something years and years ago self joining a table on an key field that looked similar to what Gus wrote.
I've done that, for a T-SQL (christmas) challenge with several artificial limitations. Never needed it in a real situation though.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 30, 2010 at 3:00 pm
Jeff Moden (11/30/2010)
Here's the link to the script. I find it difficult to believe that anyone gave it a rating of higher than 1.http://www.sqlservercentral.com/scripts/String+Manipulation/71602/
When I see things like that, I feel we need a concept of negative stars to give ratings. A range like -2 to +2 is no broader than a range of 1 to 5, but a score of -2 from a range of -2 tp +2 feels emotinally more awful than a score of 1 on the range 1 to 5.
Tom
November 30, 2010 at 3:03 pm
Tom.Thomson (11/30/2010)
Jeff Moden (11/30/2010)
Here's the link to the script. I find it difficult to believe that anyone gave it a rating of higher than 1.http://www.sqlservercentral.com/scripts/String+Manipulation/71602/
When I see things like that, I feel we need a concept of negative stars to give ratings. A range like -2 to +2 is no broader than a range of 1 to 5, but a score of -2 from a range of -2 tp +2 feels emotinally more awful than a score of 1 on the range 1 to 5.
I like it! Suggest it to Netflix. Everyone else will follow suit.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
November 30, 2010 at 3:17 pm
GilaMonster (11/30/2010)
GSquared (11/30/2010)
If it were written:
SELECT ..
FROM T1
inner join T2
on T1.a >= T2.b
inner join T3
on T1.a <= T3.c;
Would you still question it? It's the same query, but it looks "more usual".
Yes, I would. There'd have to be a really good reason for a query to need two triangular joins (and nothing else). It has the smell of someone trying to be 'smart' and 'clever' with database design.
Yeah, there are likely legit reasons for this, but not common ones.
Same here, that's the kind of thing that'd make me go back to the database structure and maybe even to the business people to ask "what are you trying to achieve".
--------------------------------------
When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
--------------------------------------
Itโs unpleasantly like being drunk.
Whatโs so unpleasant about being drunk?
You ask a glass of water. -- Douglas Adams
November 30, 2010 at 8:47 pm
To all the Threadizens that have presented - how have you incorporated this public speaking into your resume? Examples would be great!
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
November 30, 2010 at 9:02 pm
For any that might be interested in an opportunity to heckle a threadizen, check this out[/url].
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
November 30, 2010 at 9:53 pm
Grant Fritchey (11/30/2010)
Jeff Moden (11/30/2010)
Changing subjects, have you seen today's featured script? It comes under the category of "Are the featured scripts getting worse"? I try to be tolerant but some of these folks just don't have a clue. I believe I'm going to break out some polite but very high velocity pork chops later on tonight. Here's the link to the script. I find it difficult to believe that anyone gave it a rating of higher than 1.http://www.sqlservercentral.com/scripts/String+Manipulation/71602/
The scary thing for me is, like some of the more... questionable, articles, these things get high ratings. This one is only at 2.5 stars, but it's at 2.5 stars.
Even worse, it started out at 5 stars this morning and if you look at the first several posts in the discussion, several people are throwing accolades at the author for posting such "good" code.
--Jeff Moden
Change is inevitable... Change for the better is not.
November 30, 2010 at 10:02 pm
Tom.Thomson (11/30/2010)
Jeff Moden (11/30/2010)
Here's the link to the script. I find it difficult to believe that anyone gave it a rating of higher than 1.http://www.sqlservercentral.com/scripts/String+Manipulation/71602/
When I see things like that, I feel we need a concept of negative stars to give ratings. A range like -2 to +2 is no broader than a range of 1 to 5, but a score of -2 from a range of -2 tp +2 feels emotinally more awful than a score of 1 on the range 1 to 5.
Agreed... although I'd like to see a rating system of -5 to +5.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 15 posts - 22,006 through 22,020 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply