Received: from tech.com.au (IDENT:root@techpt.lnk.telstra.net [139.130.75.122]) by hub.org (8.9.3/8.9.3) with ESMTP id FAA85951 for ; Wed, 16 Feb 2000 05:04:27 -0500 (EST) (envelope-from chris@bitmead.com) Received: from bitmead.com (tardis [203.41.180.243]) by tech.com.au (8.9.3/8.9.3) with ESMTP id VAA11218; Wed, 16 Feb 2000 21:03:47 +1100 Sender: chris@tech.com.au Message-ID: <38AA7601.16B5BCB6@bitmead.com> Date: Wed, 16 Feb 2000 21:03:45 +1100 From: Chris X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12 i686) X-Accept-Language: en MIME-Version: 1.0 To: James Macken CC: pgsql-sql@postgreSQL.org Subject: Re: [SQL] How to set up a simple relational database References: <000801bf7860$ee1c7860$ad7d2bcb@jay> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit create table staff (name text, packageid int); create table package (id int, amount text); SELECT * from staff, package where staff.packageid=package.id; James Macken wrote: > > Can someone demonstrate for me how to set up a simple relational database > using the psql interactive prompt and two tables. > > For example: table 1 can be staff member and table 2 can be salary package > with a one-to-many relationship (there would be a foreign key in table Staff > Member which determined what salary package a staff member had. > > Can someone show me the commands to create the two tables, establish the > relationship between them and query the two tables so that it lists the > staff member and his/her wages (using the relationship)? > > It seems hard to find examples anywhere. > > James > > ************