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

Re: How to turn flat file to SQL

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: dj00302003(at)yahoo(dot)com (Jay Davis), pgsql-novice(at)postgresql(dot)org
Subject: Re: How to turn flat file to SQL
Date: 2004-01-19 01:25:18
Message-ID: (view raw or whole thread)
Lists: pgsql-novice

> The question is, can we put this into a SQL database just as a
> flat file, ie as one table, with one column per question, or should
> we break it into several tables, for instance with a table of 
> the "keywords" (the boxes that can be checked).  Is there any
> problem on a typical Linux box with running PostgreSql database
> with one table of 120 columns?

Well, administration with that kind of a structure will be rather a pain.  To 
answer your question in 2 parts:

1) Yes, you can load the flat file with unchanged structure.
2) Yes, you will soon wish to use something better, such as:

(incomplete pseudo-SQL)

table survey_responses (
	key (user_id, response_date)

table survey_questions (

table survey_answers (
	key (user_id, response_date, question_id)

This will make *much* more efficient use of DB resources, but requires you to 
understand relational database design.

Incidentally, among my (many) unfinished projects is to publish the structure 
and code backing the User Survey as an OSS survey-generation 
engine.  Someday ...

-Josh Berkus
 Aglio Database Solutions
 San Francisco

In response to

pgsql-novice by date

Next:From: Tom LaneDate: 2004-01-19 04:26:44
Subject: Re: New at this. Commissioning for the first time:
Previous:From: Tom LaneDate: 2004-01-18 03:28:35
Subject: Re: indexing date and timestamp fields...

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