From: degoble@sgtech
To: pgsql-general@postgresql.org.pgsql-sql
Subject: I could do with some guidance
Date: Fri, 14 Sep 2001 19:36:36 GMT
Message-ID: <3ba257f8.7067766@sgtech> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: degoble@sgtech, pgsql-general@postgresql.org.pgsql-sql
Subject: Re: I could do with some guidance
In-Reply-To: <3ba257f8.7067766@sgtech>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox