[SQL] May I have an assistance on CREATE TABLE Command

2008-09-16 Thread James Kitambara
  Hello Mambers of PGSQL-SQL,   I have two tables namely:       REGION (region_id, region_name)     DISTRICT (dist_id, dist_name, region_id (FK))   I would like to have the CREATE TABLE Command which will create these tables in such a way that when REGION table is UPDATED automatical the FOREGN KE

Re: [SQL] Insert a space between each character

2008-09-16 Thread Michael Toews
Hi, Use a regular expression, e.g.: select trim(regexp_replace('foobarbaz', '(.)', E'\\1 ', 'g')); See http://www.postgresql.org/docs/8.3/static/functions-matching.html for more. +mt Nicholas I wrote: > Hi, > > can anybody help me, to insert a space between each character in > postgresql. > >

Re: [SQL] Insert a space between each character

2008-09-16 Thread A. Kretschmer
am Wed, dem 17.09.2008, um 11:49:27 +0530 mailte Nicholas I folgendes: > Hi, > > can anybody help me, to insert a space between each character in postgresql. > > for example, > > ABC > > output > A B C write a function in plpgsql, you can use string-function like substr to split the st

[SQL] Insert a space between each character

2008-09-16 Thread Nicholas I
Hi, can anybody help me, to insert a space between each character in postgresql. for example, ABC output A B C -Dominic

Re: [SQL] surrogate vs natural primary keys

2008-09-16 Thread Scott Marlowe
On Tue, Sep 16, 2008 at 6:10 PM, Seb <[EMAIL PROTECTED]> wrote: > Hi, > > After some more reading and considering your feedback, I'm still > somewhat confused about this issue. > > 1. Should the choice of surrogate/natural primary keys be done across an > entire database, or does it make more sense

Re: [SQL] surrogate vs natural primary keys

2008-09-16 Thread Seb
Hi, After some more reading and considering your feedback, I'm still somewhat confused about this issue. 1. Should the choice of surrogate/natural primary keys be done across an entire database, or does it make more sense to do it on a per-table basis? I reckon one could do it on a per-table bas

Re: [SQL] a simple transform

2008-09-16 Thread Richard Broersma
On Tue, Sep 16, 2008 at 6:37 AM, Frank Bax <[EMAIL PROTECTED]> wrote: > > That pass the SQL into crosstab(). It might be interesting to look at this blog also: http://okbob.blogspot.com/#7449458148004287481 -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG)

Re: [SQL] surrogate vs natural primary keys

2008-09-16 Thread Andrew Sullivan
On Tue, Sep 16, 2008 at 07:59:20AM -0700, Richard Broersma wrote: > key. From my reading of some of the Celko books, he strongly ascribes > to codes as primary keys. His suggestion is to use internationally > recognized codes (if they exist) for identify items. The problem with that strategy is

Re: [SQL] surrogate vs natural primary keys

2008-09-16 Thread Richard Broersma
On Mon, Sep 15, 2008 at 3:45 PM, Scott Marlowe <[EMAIL PROTECTED]> wrote: > for > instance, when you book a flight with an airline, you'll get a locator > code like A89JK3 that is unique to any other locator code in the > system. Sure, you could make a natural key of first name, last name, > addre

Re: [SQL] a simple transform

2008-09-16 Thread Frank Bax
Karl Grossner wrote: I've thrashed at this transform for quite a while and come up empty. The crosstab() functions, and the documented examples, all do something more complex than I need. I can do this after the fact trivially in python with the 'zip()' function, but I need it real-time from a vi

Re: [SQL] Simple Problem ?

2008-09-16 Thread Guillaume Lelarge
Hengky Lie a écrit : > I have to use sql command because i want to retrieve data according to > several criteria. > The SQL command just a sample to show that the data i retrieve not > updateable. The real query like : > > SELECT * FROM TBLPRODUK WHERE SUBKAT='abc'; > > So i do not need to view d

Re: [SQL] Simple Problem ?

2008-09-16 Thread Hengky Lie
I have to use sql command because i want to retrieve data according to several criteria. The SQL command just a sample to show that the data i retrieve not updateable. The real query like : SELECT * FROM TBLPRODUK WHERE SUBKAT='abc'; So i do not need to view data from data viewer, but using

Re: [SQL] Simple Problem ?

2008-09-16 Thread Guillaume Lelarge
Hengky Lie a écrit : > This is the same as what i think but the table has primary key and has > no relation to other table. This is the table definition : > [...] > > These query result non updateable records : > > SELECT kode, namabarang from tblproduk; > > SELECT * from tblproduk; > > What is