I could do with some guidance

From: degoble(at)sgtech (David(dot) E(dot) Goble)
To: pgsql-general(at)postgresql(dot)org(dot)pgsql-sql(at)postgresql(dot)org
Subject: I could do with some guidance
Date: 2001-09-14 19:36:36
Message-ID: 3ba257f8.7067766@sgtech
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hi All;

Trying to set up a database with postgres. below is what I have so
far...

In the example I want board to be filled with;

Secretary|Goble|David|11/05/1970|280198R

How do I do this? Also is what I have so far the best way for this
database? Later I will want to write an inferface for it, in C with
libpq. Where can I get docs for dummies?

/*
### kipistol.sql ###

## Create and fill sarpa details
*/
create table sarpa
(
surname varchar(15) not null,
firstname varchar(15) not null,
inits varchar(5),
paddress varchar(29) not null,
pcity varchar(15) not null,
pcode smallint not null,
haddress varchar(29),
hcity varchar(15),
hcode smallint,
dob date,
sex varchar(01) not null,
jnr varchar(01) not null,
joined date
);

create unique index sarpa_idx
on sarpa(surname, firstname);

copy sarpa
from '//home//degoble//code//scripts//sarpa.dat'
using delimiters '|';

/*
## Create and fill local details
*/
create table kiplocal
(
surname varchar(15) not null,
firstname varchar(15) not null,
aka varchar(15),
phmain varchar(15) not null,
phsecondary varchar(15),
phmobile_fax varchar(15),
licence_no varchar(07)
);

create unique index kiplocal_idx
on kiplocal(surname, firstname, aka);

copy kiplocal
from '//home//degoble//code//scripts//local.dat'
using delimiters '|';

/*
## Create and fill expiries details
*/
create table expiries
(
licence_no varchar(07) not null,
lic_day smallint,
lic_month smallint
);

create unique index expiries_idx
on expiries(licence_no);

copy expiries
from '//home//degoble//code//scripts//expiries.dat'
using delimiters '|';

/*
## Create a view from sarpa and kiplocal
*/
create view members as
select s.surname,
s.firstname,
s.dob,
l.licence_no
from sarpa s, kiplocal l
where s.surname=l.surname and
s.firstname=l.firstname;

/*
## Create and fill board
*/
create table board
(
title varchar(15) not null
) inherits(members);

create unique index board_idx
on board(title);

commit;

/* ### the data files ### */

/* ## sarpa.dat ## */
Goble|David|DEG|Po Box 648|Kingscote|5223|9 Murray
street|Kingscote|5223|11/05/1970|M|N|01/12/1997

/* ## local.dat ## */
Goble|David|David|8553 2829|8553 2829|mobile|280198R

/* ## expiries.dat ### */
280198R|30|6

--Regards David. E. Goble
goble [AT] kin.net.au
http://www.kin.net.au/goble
Po Box 648 Kingscote, Kangaroo Island, SA 5223

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2001-09-14 19:49:24 Re: query help
Previous Message Robert Grabowski 2001-09-14 19:19:14 Re: PERL DBD::pg question

Browse pgsql-sql by date

  From Date Subject
Next Message Patrik Kudo 2001-09-14 20:34:43 Re: How do I extract ONE particular field, when multiple table
Previous Message Josh Berkus 2001-09-14 19:19:58 Re: SQL request change when upgrade from 7.0.2 to 7.1.3