[SQL] trying to pattern match to a value contained in a column

2000-12-07 Thread Beth Gatewood
Hi- I can't figure out how to do this I examine a table where I think that one attribute is an abbreviation of another attribute. So-If I had a table where I had LONG_NAME and ABBR as attributes. I want something like SELECT whatever FROM my_table WHERE long_name LIKE '%[the value of ABBR

Re: [SQL] trying to pattern match to a value contained in a column

2000-12-07 Thread Beth Gatewood
--+--- > fs | fsolomon > bg | bgatewood > > Note that ~ does a case-sensitive regex match. If you really want a > 'like' match, you could do this instead: > > SELECT * FROM abbrev where long_name~~('%' || abbr || '%'); > > ... where &

Re: [SQL] make a unique index for foreign keys?

2002-06-13 Thread Beth Gatewood
Chris/ Josh- OK-response to Chris below. Synopsis heresimply by creating a foreign key will not create an index. On large tables I SHOULD put a non-unique index on the foreign key (right?) Hmm...nope. Creating a foreign key doesn't create an index. However, creating a primary key does

[SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Beth Gatewood
Hi all- I am wondering if I can get some input on the logic that I would need to code a function that would mimic mysql's last_insert_id().. Here is what last_insert_id() does in mysql: Returns the last automatically generated value that was inserted into an AUTO_INCREMENT column. mysql> SELECT

Re: [SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Beth Gatewood
; From: Josh Berkus [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, September 11, 2002 10:31 AM > To: Beth Gatewood; [EMAIL PROTECTED] > Subject: Re: [SQL] writing a function to mimic mysql last_insert_id > > > > Beth, > > > I am wondering if I can get some input on the l

Re: [SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Beth Gatewood
was to trying to avoid having the developers make a lot of sql revisions to their application. Thanks-Beth > -Original Message- > From: Christopher Kings-Lynne [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, September 11, 2002 7:05 PM > To: Beth Gatewood; [EMAIL PROTECTED] > Su

Re: [SQL] indexing on char vs varchar

2002-10-02 Thread Beth Gatewood
Thanks for the excellent description, Josh. And the reminder of the performance list (it's existence somehow slipped from my mind). -Beth > -Original Message- > From: Josh Berkus [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 02, 2002 10:56 AM > To: Beth Gatewoo

[SQL] indexing on char vs varchar

2002-10-02 Thread Beth Gatewood
Hi- This is more just trying to understand what is going on under the hood of pgsql. I have read through the archives that there is no difference between index on char, varchar or text. I am wondering why? I understand all the arguments about saving space but I am specifically asking about ind

Re: [SQL] indexing on char vs varchar

2002-10-02 Thread Beth Gatewood
SorryI don't understand. The length is at the front of what? -Beth > -Original Message- > From: Bruce Momjian [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 02, 2002 10:06 AM > To: Beth Gatewood > Cc: [EMAIL PROTECTED] > Subject: Re: [SQL] inde