| From: | Chris <chris(at)bitmead(dot)com> |
|---|---|
| To: | James Macken <jmac(at)nemesis(dot)com(dot)au> |
| Cc: | pgsql-sql(at)postgreSQL(dot)org |
| Subject: | Re: [SQL] How to set up a simple relational database |
| Date: | 2000-02-16 10:03:45 |
| Message-ID: | 38AA7601.16B5BCB6@bitmead.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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
>
> ************
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Moray McConnachie | 2000-02-16 10:34:02 | Re: [SQL] How to set up a simple relational database |
| Previous Message | James Macken | 2000-02-16 09:33:47 | How to set up a simple relational database |