pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
abs value, power, sqrt
3+ messages / 3 participants
[nested] [flat]

* abs value, power, sqrt
@ 1998-11-20 05:53 Michael Olivier <molivier@yahoo.com>
  1998-11-20 07:00 ` Re: [SQL] abs value, power, sqrt Ulf Mehlig <umehlig@uni-bremen.de>
  1998-11-21 00:44 ` Re: [SQL] abs value, power, sqrt Bob Smither <smither@C-C-I.Com>
  0 siblings, 2 replies; 3+ messages in thread

From: Michael Olivier @ 1998-11-20 05:53 UTC (permalink / raw)
  To: pgsql-sql

Hi folks,

I previously posted this to pgsql-novice but haven't gotten an answer,
so I thought I'd try here.

I need a way to get abs value of a floating point number and (possibly
separate function for) abs value of an integer in a select statement.
Is there a function to do this? If not, how can I write a function to
do it?

Also how do I do squares and square roots? I saw some \|/ type notation
for square root in an SQL book, but I didn't get postgres to take that.

thanks,
Michael

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] abs value, power, sqrt
  1998-11-20 05:53 abs value, power, sqrt Michael Olivier <molivier@yahoo.com>
@ 1998-11-20 07:00 ` Ulf Mehlig <umehlig@uni-bremen.de>
  1 sibling, 0 replies; 3+ messages in thread

From: Ulf Mehlig @ 1998-11-20 07:00 UTC (permalink / raw)
  To: molivier@yahoo.com; +Cc: pgsql-sql

Michael Olivier <molivier@yahoo.com> wrote:

> I need a way to get abs value of a floating point number and
> (possibly separate function for) abs value of an integer in a select
> statement.

You had to look up the manuals  at numerical *operators* -- no need to
define YAF ;-)

      => select @-17.0;
   17                       

> Also how do I do squares and square roots? I saw some \|/ type
> notation for square root in an SQL book, but I didn't get postgres
> to take that.

try e.g.

      => select 2*2, 2^2;
   4        4          

and:
      => select |/2;
   1.4142135623731  

without the backslash (originally quoting in a shell?) it seems to
work ...

Hope it helps
Ulf

-- 
======================================================================
 %%%%%            Ulf Mehlig              <umehlig@zmt.uni-bremen.de>
   %%%%!%%%       Projekt "MADAM"         <umehlig@uni-bremen.de>
%%%% %!% %%%%     ----------------------------------------------------
 ---| %%%         MADAM:  MAngrove    |  Center for Tropical Marine
    ||--%!%              Dynamics     |  Biology
    ||                  And           |  Fahrenheitstrasse 1
 _ /||\_/\_            Management     |  
/  /    \  \ ~~~~~~~~~~~~~~~~~        |  28359 Bremen/Germany
  ~~~~~~~~~~~~~~~~~~~~



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] abs value, power, sqrt
  1998-11-20 05:53 abs value, power, sqrt Michael Olivier <molivier@yahoo.com>
@ 1998-11-21 00:44 ` Bob Smither <smither@C-C-I.Com>
  1 sibling, 0 replies; 3+ messages in thread

From: Bob Smither @ 1998-11-21 00:44 UTC (permalink / raw)
  To: Michael Olivier <molivier@yahoo.com>; +Cc: pgsql-sql

On Thu, 19 Nov 1998, Michael Olivier wrote:

:Hi folks,
:
:I previously posted this to pgsql-novice but haven't gotten an answer,
:so I thought I'd try here.
:
:I need a way to get abs value of a floating point number and (possibly
:separate function for) abs value of an integer in a select statement.
:Is there a function to do this? If not, how can I write a function to
:do it?
:
:Also how do I do squares and square roots? I saw some \|/ type notation
:for square root in an SQL book, but I didn't get postgres to take that.

On my RH installation I found:

  file:/usr/doc/postgresql-6.3.2/user/c05.htm

which I have attached.  It documents the operators and functions
available.  Examples of your specific operators are:

  absolute value: @-5
  square root   : |/ 25

Square would just be x * x or use the exponentiation operator:

  2.0 ^ 3.0

As an example, here is a snippet from a perl cgi script that finds all the
zip codes within a specified radius of a target location.  The target
location is specified by $lat and $lon (in degrees), the radius by
$Radius (in miles).

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#! /usr/bin/perl -w
# file: zips.by.location.m4

snip ...

# radius is in miles ...
$Radius = $input{'radius'};
# convert radius to degrees, circumference is pi * d
$Radius = $Radius * 360.0 / (7900.0 * atan2(1,1) * 4.0);
$RadiusSquared = $Radius * $Radius;

snip ...

# call psql to find the zip codes ...
$temp = qx{ psql -d lrcf -c "
  select
    city, state, zip5,
    population, latitude, longitude
  from
    zips
  where
    ( ( ((latitude - $lat) ^ 2.0) +
       ((longitude - $lon) ^ 2.0) )
      < $RadiusSquared );" };

# print results to html page
print "<pre>$temp</pre>";

snip ...

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Hope this helps,
======================================================================
Bob Smither, Ph.D.      281-331-2744; fax:-4616      Smither@C-C-I.Com
Windows - making simple things easy, and interesting things impossible
======================================================================

Attachments:

c05.htm (text/html, 14.8K) download <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML ><HEAD ><TITLE >Operators</TITLE ><META NAME="CREATOR" CONTENT="Modular DocBook HTML Stylesheet version 1.07"><META NAME="form" CONTENT="html"></HEAD ><BODY BGCOLOR="#FFFFFF" TEXT="#000000" ><TABLE WIDTH="515" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PostgreSQL User's Guide</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="c0406.htm" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="c06.htm" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="515"><H1 ><A NAME="R,C(5,CHAPTER)" >Chapter 5. Operators</A ></H1 ><P >Postgres provides a large number of built-in operators on system types. These operators are declared in the system catalog pg_operator. Every entry in pg_operator includes the name of the procedure that implements the operator and the class OIDs of the input and output types.&#13;</P ><P >To view all variations of the &#8220;||&#8221; string concatenation operator, try <PRE CLASS="PROGRAMLISTING" > SELECT oprleft, oprright, oprresult, oprcode FROM pg_operator WHERE oprname = '||'; oprleft|oprright|oprresult|oprcode -------+--------+---------+------- 25| 25| 25|textcat 1042| 1042| 1042|textcat 1043| 1043| 1043|textcat (3 rows)</PRE ></P ><P ><DIV CLASS="TABLE" ><P ><B >Table 5-1. Postgres Operators</B ></P ><TABLE BORDER="1" ><TR ><TH ALIGN="LEFT" VALIGN="TOP" >Operator</TH ><TH ALIGN="LEFT" VALIGN="TOP" >Description</TH ><TH ALIGN="LEFT" VALIGN="TOP" >Usage</TH ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#60; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Less than?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >1 &#60; 2</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#60;= </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Less than or equal to?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >1 &#60;= 2</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#60;&#62; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Not equal?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >1 &#60;&#62; 2</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > = </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Equal?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >1 = 1</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#62; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Greater than?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >2 &#62; 1</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#62;= </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Greater than or equal to?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >2 &#62;= 1</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > || </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Concatenate strings</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'Postgre' || 'SQL'</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > !!= </TD ><TD ALIGN="LEFT" VALIGN="TOP" >NOT IN</TD ><TD ALIGN="LEFT" VALIGN="TOP" >3 !!= i</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ~~ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >LIKE</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'scrappy,marc,hermit' ~~ '%scrappy%'</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > !~~ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >NOT LIKE</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'bruce' !~~ '%al%'</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ~ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Match (regex), case sensitive</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'thomas' ~ '*.thomas*.'</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ~* </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Match (regex), case insensitive</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'thomas' ~* '*.Thomas*.'</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > !~ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Does not match (regex), case sensitive</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'thomas' !~ '*.Thomas*.'</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > !~* </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Does not match (regex), case insensitive</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'thomas' !~ '*.vadim*.'</TD ></TR ></TABLE ></DIV ></P ><P ><DIV CLASS="TABLE" ><P ><B >Table 5-2. Postgres Numerical Operators</B ></P ><TABLE BORDER="1" ><TR ><TH ALIGN="LEFT" VALIGN="TOP" >Operator</TH ><TH ALIGN="LEFT" VALIGN="TOP" >Description</TH ><TH ALIGN="LEFT" VALIGN="TOP" >Usage</TH ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ! </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Factorial</TD ><TD ALIGN="LEFT" VALIGN="TOP" >3 !</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > !! </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Factorial (left operator)</TD ><TD ALIGN="LEFT" VALIGN="TOP" >!! 3</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > % </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Modulo</TD ><TD ALIGN="LEFT" VALIGN="TOP" >5 % 4</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > % </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Truncate</TD ><TD ALIGN="LEFT" VALIGN="TOP" >% 4.5</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > * </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Multiplication</TD ><TD ALIGN="LEFT" VALIGN="TOP" >2 * 3</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > + </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Addition</TD ><TD ALIGN="LEFT" VALIGN="TOP" >2 + 3</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > - </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Subtraction</TD ><TD ALIGN="LEFT" VALIGN="TOP" >2 - 3</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > / </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Division</TD ><TD ALIGN="LEFT" VALIGN="TOP" >4 / 2</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > : </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Natural Exponentiation</TD ><TD ALIGN="LEFT" VALIGN="TOP" >: 3.0</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Natural Logarithm</TD ><TD ALIGN="LEFT" VALIGN="TOP" >(; 5.0)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > @ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Absolute value</TD ><TD ALIGN="LEFT" VALIGN="TOP" >@ -5.0</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ^ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Exponentiation</TD ><TD ALIGN="LEFT" VALIGN="TOP" >2.0 ^ 3.0</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > |/ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Square root</TD ><TD ALIGN="LEFT" VALIGN="TOP" >|/ 25.0</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ||/ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Cube root</TD ><TD ALIGN="LEFT" VALIGN="TOP" >||/ 27.0</TD ></TR ></TABLE ></DIV ></P ><P ><DIV CLASS="TABLE" ><P ><B >Table 5-3. Postgres Geometric Operators</B ></P ><TABLE BORDER="1" ><TR ><TH ALIGN="LEFT" VALIGN="TOP" >Operator</TH ><TH ALIGN="LEFT" VALIGN="TOP" >Description</TH ><TH ALIGN="LEFT" VALIGN="TOP" >Usage</TH ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > + </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Translation</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),(1,1))'::box + '(2.0,0)'::point</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > - </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Translation</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),(1,1))'::box - '(2.0,0)'::point</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > * </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Scaling/rotation</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),(1,1))'::box * '(2.0,0)'::point</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > / </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Scaling/rotation</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),(2,2))'::box / '(2.0,0)'::point</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > # </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Intersection</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((1,-1),(-1,1))' # '((1,1),(-1,-1))'</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > # </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Number of points in polygon</TD ><TD ALIGN="LEFT" VALIGN="TOP" ># '((1,0),(0,1),(-1,0))'</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ## </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Point of closest proximity</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'(0,0)'::point ## '((2,0),(0,2))'::lseg</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#38;&#38; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Overlaps?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),(1,1))'::box &#38;&#38; '((0,0),(2,2))'::box</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#38;&#60; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Overlaps to left?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),(1,1))'::box &#38;&#60; '((0,0),(2,2))'::box</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#38;&#62; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Overlaps to right?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),(3,3))'::box &#38;&#62; '((0,0),(2,2))'::box</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#60;-&#62; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Distance between</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),1)'::circle &#60;-&#62; '((5,0),1)'::circle</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#60;&#60; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Left of?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),1)'::circle &#60;&#60; '((5,0),1)'::circle</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#60;^ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Is below?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),1)'::circle &#60;^ '((0,5),1)'::circle</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#62;&#62; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Is right of?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((5,0),1)'::circle &#62;&#62; '((0,0),1)'::circle</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#62;^ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Is above?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,5),1)'::circle &#62;^ '((0,0),1)'::circle</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ?# </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Intersects or overlaps</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((-1,0),(1,0))'::lseg ?# '((-2,-2),(2,2))'::box;</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ?- </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Is horizontal?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'(1,0)'::point ?- '(0,0)'::point</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ?-| </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Is perpendicular?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > @-@ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Length or circumference</TD ><TD ALIGN="LEFT" VALIGN="TOP" >@-@ '((0,0),(1,0))'::path</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ?| </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Is vertical?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'(0,1)'::point ?| '(0,0)'::point</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ?|| </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Is parallel?</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((-1,0),(1,0))'::lseg ?|| '((-1,2),(1,2))'::lseg</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > @ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Contained or on</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'(1,1)'::point @ '((0,0),2)'::circle</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > @@ </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Center of</TD ><TD ALIGN="LEFT" VALIGN="TOP" >@@ '((0,0),10)'::circle</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ~= </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Same as</TD ><TD ALIGN="LEFT" VALIGN="TOP" >'((0,0),(1,1))'::polygon ~= '((1,1),(0,0))'::polygon</TD ></TR ></TABLE ></DIV ></P ><P >The time interval data type tinterval is a legacy from the original date/time types and is not as well supported as the more modern types. There are several operators for this type. <DIV CLASS="TABLE" ><P ><B >Table 5-4. Postgres Time Interval Operators</B ></P ><TABLE BORDER="1" ><TR ><TH ALIGN="LEFT" VALIGN="TOP" >Operator</TH ><TH ALIGN="LEFT" VALIGN="TOP" >Description</TH ><TH ALIGN="LEFT" VALIGN="TOP" >Usage</TH ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > #&#60; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Interval less than?</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > #&#60;= </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Interval less than or equal to?</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > #&#60;&#62; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Interval not equal?</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > #= </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Interval equal?</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > #&#62; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Interval greater than?</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > #&#62;= </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Interval greater than or equal to?</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#60;#&#62; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Convert to time interval</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#60;&#60; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Interval less than?</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > | </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Start of interval</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > ~= </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Same as</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" > &#60;?&#62; </TD ><TD ALIGN="LEFT" VALIGN="TOP" >Time inside interval?</TD ><TD ALIGN="LEFT" VALIGN="TOP" ></TD ></TR ></TABLE ></DIV ></P ><P >Users may invoke operators using the operator name, as in: <PRE CLASS="PROGRAMLISTING" >select * from emp where salary &#60; 40000;</PRE > Alternatively, users may call the functions that implement the operators directly. In this case, the query above would be expressed as: <PRE CLASS="PROGRAMLISTING" >select * from emp where int4lt(salary, 40000);</PRE >&#13;</P ><P >psql has a <B CLASS="COMMAND" >\dd</B > command to show these operators.</P ><HR ALIGN="LEFT" WIDTH="515"><TABLE WIDTH="515" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="c0406.htm" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="book01.htm" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="c06.htm" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Geometric Types</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" >&nbsp;</TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Functions</TD ></TR ></TABLE ></BODY ></HTML >
^ permalink raw reply [nested|flat] 3+ messages in thread


end of thread, other threads:[~1998-11-21 00:44 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-11-20 05:53 abs value, power, sqrt Michael Olivier <molivier@yahoo.com>
1998-11-20 07:00 ` Ulf Mehlig <umehlig@uni-bremen.de>
1998-11-21 00:44 ` Bob Smither <smither@C-C-I.Com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox