pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
I could do with some guidance
2+ messages / 2 participants
[nested] [flat]

* I could do with some guidance
@ 2001-09-14 19:36 David. E. Goble <degoble@sgtech>
  2001-09-17 15:27 ` Re: I could do with some guidance Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 2+ messages in thread

From: degoble@sgtech @ 2001-09-14 19:36 UTC (permalink / raw)
  To: pgsql-general@postgresql.org.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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: I could do with some guidance
  2001-09-14 19:36 I could do with some guidance David. E. Goble <degoble@sgtech>
@ 2001-09-17 15:27 ` Josh Berkus <josh@agliodbs.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Josh Berkus @ 2001-09-17 15:27 UTC (permalink / raw)
  To: pgsql-sql

David,

> 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?

Er ... what's your question, David? You seem to have everything
together.

If you're looking for outside resources on database-building:

"PostgreSQL: Introduction And Concepts" for an intro to Postgres.
"Database Design For Mere Mortals" for an intro on how to structure
databases.

The Postgresql online docs are your best source for help with C and
libpq.

-Josh




______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology josh@agliodbs.com
   and data management solutions (415) 565-7293
  for law firms, small businesses fax 621-2533
    and non-profit organizations. San Francisco



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-09-17 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-09-14 19:36 I could do with some guidance David. E. Goble <degoble@sgtech>
2001-09-17 15:27 ` Josh Berkus <josh@agliodbs.com>

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