Received: from ms1.nypost.com ([65.209.114.183]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fBAMEdm40048 for ; Mon, 10 Dec 2001 17:14:39 -0500 (EST) (envelope-from hjohnson@nypost.com) Received: from sephie (172.16.11.81) by ms1.nypost.com (Worldmail 1.3.167); 10 Dec 2001 17:14:41 -0500 Message-ID: <020e01c181c7$d7ebbbb0$510b10ac@sephie> From: "Heather Johnson" To: Cc: "Harry Ford" , "Serge Canizares" , "Marie Musacchio" Subject: FOLLOW UP: problems doing sub-selects on PostgreSQL 7.1.3 and Solaris 7 Date: Mon, 10 Dec 2001 17:13:06 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_020B_01C1819D.EF07F810" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200112/70 X-Sequence-Number: 2794 This is a multi-part message in MIME format. ------=_NextPart_000_020B_01C1819D.EF07F810 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable FYI--Here are the table creation statements for the tables involved in the = sample query. -- user_id_sequence CREATE SEQUENCE user_id_sequence INCREMENT 1 START 100; -- users -- table for basic user data CREATE TABLE users ( id INTEGER NOT NULL PRIMARY KEY -- unique id for each user DEFAULT nextval('user_id_sequence'), f_name VARCHAR(128) NOT NULL, -- user's first name l_name VARCHAR(192) NOT NULL, -- user's last name=20=20= =20 email VARCHAR(256) UNIQUE NOT NULL, -- user's email address password VARCHAR(16) NOT NULL, -- user's password hint VARCHAR(256), -- hint for password dt_registered TIMESTAMP DEFAULT timestamp('now'), --timestamp format is= : YYYY-MM-DD HH:MM:SS-05 user_generated_p CHAR(1) NOT NULL -- user-generated predicate CHECK( user_generated_p IN('t', 'f')), -- true or false specified opt_in_p CHAR(1) NOT NULL -- opt in value DEFAULT 't' -- true or false specified CHECK( opt_in_p IN('t', 'f'))=20=20=20=20=20=20=20=20=20=20 ); -- user_demographics -- table to hold user's demographics data CREATE TABLE users_demographics ( users_id INTEGER NOT NULL PRIMARY KEY -- user's id REFERENCES users(id), sal VARCHAR(5) CHECK( sal IN('MR', 'MS', 'MISS', 'MRS', 'OTHE= R')),=20 -- salutation addr1 VARCHAR(256), -- user's address line 1 addr2 VARCHAR(256), -- user's address line 2 city VARCHAR(64), -- user's city state CHAR(2) NOT NULL, -- state of residence zip CHAR(5) NOT NULL, -- zip code area_code VARCHAR(3) NOT NULL, -- area code phone VARCHAR(15), -- phone number country CHAR(2) NOT NULL REFERENCES country_codes(code) DEFAULT 'US',=20=20 -- country of residence income VARCHAR(7) REFERENCES income_codes(code),=20=20=20=20 -- user's income level gender CHAR(1) NOT NULL -- gender CHECK( gender IN('m', 'f', 'u')),=20 -- male or female or sp= ecified birth_year INTEGER, -- birth year birth_month INTEGER, -- birth month birth_day INTEGER -- birth day ); ------=_NextPart_000_020B_01C1819D.EF07F810 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
FYI--Here are the table creation statement= s for the=20 tables involved in the sample query.
 
-- user_id_sequence
CREATE SEQU= ENCE=20 user_id_sequence INCREMENT 1 START 100;
 
-- users
-- table for basic use= r=20 data
CREATE TABLE users (
 
 id        =20     INTEGER   NOT NULL PRIMARY KEY  = ;--=20 unique id for each=20 user
           &= nbsp;   =20 DEFAULT=20 nextval('user_id_sequence'),
 f_name     &= nbsp;  =20 VARCHAR(128)  NOT NULL,        = ; --=20 user's first name
 l_name        = ;=20 VARCHAR(192)  NOT NULL,        = ; --=20 user's last name   
 email    &n= bsp;=20     VARCHAR(256)  UNIQUE NOT NULL,  -- user's= =20 email address
 password      =20 VARCHAR(16)   NOT=20 NULL,         -- user's=20 password
 hint         &nbs= p;=20 VARCHAR(256),          &n= bsp;        --=20 hint for password
 dt_registered  TIMESTAMP DEFAULT= =20 timestamp('now'),   --timestamp format is: YYYY-MM-DD=20 HH:MM:SS-05
 user_generated_p CHAR(1)   NOT=20 NULL            = ;--=20 user-generated=20 predicate
          &n= bsp;  =20     CHECK( user_generated_p IN('t',=20 'f')),
           = ;         =20                = =20            -- true or false=20 specified
 opt_in_p      =20 CHAR(1)   NOT=20 NULL            &nbs= p; --=20 opt in=20 value
           =      DEFAULT=20 't'            =20         -- true or false=20 specified
          &n= bsp;     CHECK(=20 opt_in_p IN('t',=20 'f'))          
);
 
-- user_demographics
-- table t= o hold=20 user's demographics data
CREATE TABLE users_demographics (
 
 users_id   &n= bsp;=20     INTEGER    NOT NULL PRIMARY KEY &nbs= p;--=20 user's=20 id
           &nb= sp;=20      REFERENCES=20 users(id),
 sal        &nbs= p;     VARCHAR(5) CHECK(=20 sal IN('MR', 'MS', 'MISS', 'MRS',=20 'OTHER')), 
         &= nbsp;         =20                = =20                = --=20 salutation
 addr1        &n= bsp;   VARCHAR(256),      &nbs= p;     =20         -- user's address line=20 1
 addr2          = ;  VARCHAR(256),        &= nbsp;   =20         -- user's address line=20 2
 city          =    VARCHAR(64),       &nb= sp;    =20          -- user's=20 city
 state          &= nbsp;=20 CHAR(2)    NOT=20 NULL,            &nb= sp;=20 -- state of=20 residence
 zip         = ;     CHAR(5)    NOT=20 NULL,            &nb= sp;=20 -- zip=20 code
 area_code        VARC= HAR(3)   NOT=20 NULL,           &nbs= p;--=20 area=20 code
 phone         &n= bsp;  VARCHAR(15),        = ;    =20          -- phone=20 number
 country         =20 CHAR(2)    NOT=20 NULL
           &= nbsp;=20      REFERENCES=20 country_codes(code)
        &nbs= p;         DEFAULT=20 'US',  
         =           =20                = =20                = --=20 country of residence
 income     =20      VARCHAR(7)   REFERENCES=20 income_codes(code),    
    &nbs= p;            &= nbsp; =20                = =20                = --=20 user's income level
 gender     =20      CHAR(1)    NOT=20 NULL            = ;   --=20 gender
           = ; =20      CHECK( gender IN('m', 'f',=20 'u')), 
          = ;         =20                = =20                = --=20 male or female or=20 specified
 birth_year       INTE= GER,            = ; =20             -- birth=20 year
 birth_month     =20 INTEGER,           &= nbsp; =20             -- birth=20 month
 birth_day       =20 INTEGER           &n= bsp;  =20             -- birth=20 day
);
------=_NextPart_000_020B_01C1819D.EF07F810--