I could do with some guidance - Mailing list pgsql-sql
From | degoble@sgtech (David. E. Goble) |
---|---|
Subject | I could do with some guidance |
Date | |
Msg-id | 3ba257f8.7067766@sgtech Whole thread Raw |
Responses |
Re: I could do with some guidance
|
List | 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