473,466 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Predicate equivalence: concat vs. AND

Looked everywhere (Date, Celko, Elmasri, this ng, c.d.t, etc), but can't
find any discussion of the following:

Proof that these predicates will (or not) return the same rows

where (col1 concat col2 concat col3 ...) =<SomeSuitableString>

where col1 =itsPartOfSomeSuitableString and
col2 =itsPartOfSomeSuitableString and
col3 =itsPartOfSomeSuitableString ...

short of exhaustive enumeration, of course. A bit of scribbling with
some data indicates, Yes. But that's not the general case.

The latter is preferable, for obvious reasons.
May 30 '07 #1
3 2310
MeBuggyYouJane wrote:
Looked everywhere (Date, Celko, Elmasri, this ng, c.d.t, etc), but can't
find any discussion of the following:

Proof that these predicates will (or not) return the same rows

where (col1 concat col2 concat col3 ...) =<SomeSuitableString>
I don't think this is true if any of the columns is a VARCHAR.
And of course it won't be true for complex collations
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 30 '07 #2
MeBuggyYouJane wrote:
Looked everywhere (Date, Celko, Elmasri, this ng, c.d.t, etc), but can't
find any discussion of the following:

Proof that these predicates will (or not) return the same rows

where (col1 concat col2 concat col3 ...) =<SomeSuitableString>

where col1 =itsPartOfSomeSuitableString and
col2 =itsPartOfSomeSuitableString and
col3 =itsPartOfSomeSuitableString ...

short of exhaustive enumeration, of course. A bit of scribbling with
some data indicates, Yes. But that's not the general case.
Smells very much like an exercise to me.

The answer is obvious once you consider ordering. (That should be enough of
a hint.)

p.s: What kind of operator is "=>" supposed to be?

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
May 30 '07 #3
MeBuggyYouJane wrote:
Looked everywhere (Date, Celko, Elmasri, this ng, c.d.t, etc), but can't
find any discussion of the following:

Proof that these predicates will (or not) return the same rows

where (col1 concat col2 concat col3 ...) =<SomeSuitableString>

where col1 =itsPartOfSomeSuitableString and
col2 =itsPartOfSomeSuitableString and
col3 =itsPartOfSomeSuitableString ...

short of exhaustive enumeration, of course. A bit of scribbling with
some data indicates, Yes. But that's not the general case.

The latter is preferable, for obvious reasons.
Oh, and "WHERE ..." is not a predicate. It is a WHERE clause, which consists
of the keyword WHERE followed by a predicate.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
May 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gerald Aichholzer | last post by:
Hello, I need to specify the following attribute in an xhtml-file containing TAL templates: <div tal:attributes="onMouseOver concat('func(',xyz,')')"> which results in <div...
4
by: hall | last post by:
I accidently overloaded a static member function that I use as predicate in the std::sort() for a vector and ended up with a compiler error. Is this kind of overload not allowed for predicates and...
5
by: matthias_k | last post by:
Hi, I need to sort elements of a std::list using a function predicate, something like: bool predicate( const& M m1, const& M m2 ) { return m1.somedata < m2.somedata; } I tried to call...
1
by: Trint Smith | last post by:
Ok, I have a webform that has these checkboxes: 1. something 2. something else 3. and something else When the user clicks on the checkbox, I want all of the selections to go into a textbox...
8
by: Jeff S. | last post by:
I was recently advised: << Use List<struct> and Find() using different Predicate delegates for your different search needs.>> What is "Predicate delegate" as used in the above recommendation? ...
4
by: Martin Evans | last post by:
Hi, I'm getting: DBD::DB2::db do failed: SQL0440N No authorized routine named "CONCAT" of type "FUNCTION" having compatible arguments was found. SQLSTATE=42884 for some SQL like this:
4
by: PaulR | last post by:
Hi, (re: DB2 LUW v8.1 fp8 optimisation Level2) Can anyone explain why the following difference have wildly different plans - this seems very fundamental) select p.part_number,...
6
by: Phantom | last post by:
I totally need the help of the XML experts up here, I can't figure this one out, I've been working on it for hours today, googling my brains out. I need to write an xpath query string that...
5
by: Ganesh | last post by:
hi ! Can the predicate function used in std::sort take optional arguments ? For instance. I have a class Point. I create a vector of this and then want to compare the slopes of these points with...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.