Skip site navigation (1) Skip section navigation (2)

indexes and relationships

From: bill house <wchouse(at)bellsouth(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: indexes and relationships
Date: 2009-12-27 19:06:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

I am new to sql of any sort. I have selected postgresql to learn and am 
in the process of trying to train myself.  I am using 8.3 on linux.

My first self assignment is to get the data from the nutritional 
database published by USDA into a postgresql database.

This database is available at

at a button at the bottom when it isn't busy.

Based on their documentation I have created the tables, converted the 
text files to csv files and inserted the data.

Now I am in the process of setting up the relationships.

Most of the relationships are relatively straightforward but one is more 
challenging, at least to me.

The data in one file uses two fields to refer to the data in another 
file which will use one field or two fields as the case may be.

When I searched the novice archives, the search tool referred to a 
manual page (paragraph 11.5) which seemed to be on point and discussed 
multiple indexes.

Unfortunately, I did not see any example of usage in the manual.

Would someone please provide an example of the implementation of this 

Actual data and notes follow:


data in one file contains empty fields or
one line referrs to all items with a part of key value
data is:

table d06_nut_dat.csv
   field1, field2, field3, field4, ...
->"02048","203",0.00,3,0.000,"1","A","","",1,0.00,0.00,,,,"2- 3"
   "02048","204",0.00,3,0.000,"1","A","","",1,0.00,0.00,,,,"1- 2- 3"

table d11_footnote.csv
   field1, field2, field3, field4, ...
   "02034","01","N","204","Total proximates do not equal 100% because 
              	piperine was subtracted from libid value."
->"02048","01","D","","Contains 5% acetic acid.  Total proximates do 
not 	equal 100%"
=>"02048","02","N","208","Acetic acid is included in energy 			 
   "02053","01","D","","Contains 5% acetic acid.  Total proximates do 
not 	equal 100%"


Thanks in advance,

Bill House


pgsql-novice by date

Next:From: Bob McConnellDate: 2009-12-27 22:35:31
Subject: Re: indexes and relationships
Previous:From: sfarley1Date: 2009-12-25 17:42:56
Subject: PostgreSQL 8.3 and Windows 7

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group