rupesh bajaj wrote:
Hi,
Is Like operator can be used to join two relation. If yes what is its use?
And how it is used?

It tests a column for a partial match. So:

'abc' LIKE 'a%' = true
'abc' LIKE 'a_c' = true
'abc' LIKE 'A%' = false

See the manuals for details on other wildcard options and alternative pattern-matching systems.

You can store the pattern in a column too, though that's less common:

richardh=> SELECT * FROM targets;
    tgt
-----------
 abc123def
 ghi123def
(2 rows)

richardh=> SELECT * FROM patterns;
 patt
-------
 abc%
 %123%
(2 rows)

richardh=> SELECT tgt,count(*) FROM targets, patterns
WHERE tgt LIKE patt GROUP BY tgt ORDER BY tgt;
    tgt    | count
-----------+-------
 abc123def |     2
 ghi123def |     1
(2 rows)

HTH
--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to