Re: [SQL] viewing the description of tables from python DB-API

2006-08-01 Thread Rodrigo De Leon
On 8/1/06, Daniel Joo <[EMAIL PROTECTED]> wrote: Hi all, Is there a way to view the list of all tables from python (or any other languages for that matter) DB-API? What I'm looking for is a command similar to the meta-command '\d' that works with the psql client. Thanks very much! Dan

Re: [SQL] CREATE TABLE AS inside of a function

2006-07-21 Thread Rodrigo De Leon
On 7/21/06, Kevin Nikiforuk <[EMAIL PROTECTED]> wrote: So now that I've got my loops working, on to my next newbie question. I've created my function and in it, I want to loop through the results of a select and for each value of my loop counter, I want to create a new table, but I can't figu

Re: [SQL] SELECT substring with regex

2006-07-08 Thread Rodrigo De Leon
On 7/8/06, T E Schmitz <[EMAIL PROTECTED]> wrote: Is regexp_replace a new feature? I am running v 7.4. Given the patch history: http://archives.postgresql.org/pgsql-patches/2004-07/msg00471.php http://archives.postgresql.org/pgsql-patches/2005-06/msg00515.php http://archives.postgresql.org/pgs

Re: [SQL] SELECT substring with regex

2006-07-07 Thread Rodrigo De Leon
On 7/7/06, T E Schmitz <[EMAIL PROTECTED]> wrote: Sorry, but that would also capture something like 10-30-59mm The pattern describes either a single length (120 millimeters) or a range (30 to 70 millimetres), hence: \\d+(-\\d+)?mm The ? quantifier refers to the combination of '-' and digits an

Re: [SQL] SELECT substring with regex

2006-07-07 Thread Rodrigo De Leon
On 7/7/06, T E Schmitz <[EMAIL PROTECTED]> wrote: But that takes me to the next problem: For the sake of the example I simplified the regular pattern. In reality, BASE_NAME might be: 28mm 28-70mm So the reg. expr. requires brackets: substring (NAME, '^(\\d+(-\\d+)?mm)' ) as BASE_NAME Actuall

Re: [SQL] SELECT substring with regex

2006-07-07 Thread Rodrigo De Leon
On 7/7/06, T E Schmitz <[EMAIL PROTECTED]> wrote: I would like to split the contents of a column using substring with a regular expression: SELECT substring (NAME, '^\\d+mm') as BASE_NAME, substring (NAME, ??? ) as SUFFIX FROM MODEL The column contains something like "150mm LD AD Asp XR Mac

Re: [SQL] Select Maths

2006-07-07 Thread Rodrigo De Leon
On 7/7/06, Phillip Smith <[EMAIL PROTECTED]> wrote: Hi again, G'day (it's 03:21 on a friday here). Same SELECT query as before, different area of it… I have a function that calculates the recommended purchase order quantity for a stock item based off various other values and functions: pqty(

Re: [SQL] week ending

2006-07-06 Thread Rodrigo De Leon
On 7/5/06, Keith Worthington <[EMAIL PROTECTED]> wrote: Hi All, I just finished writing a query that groups data based on the week number. SELECT EXTRACT(week FROM col_a) AS week_number, sum(col_b) AS col_b_total FROM foo WHERE foobar GROUP BY EXTRACT(week FROM col_a) ORDER BY