Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Novice > convert text fi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 3073 of 3175
Post > Topic >>

convert text file to database

by inpost@[EMAIL PROTECTED] (e-letter) Apr 13, 2008 at 07:58 AM

Readers,

I play chess and occasionally (i.e. when I win!) I save the moves to a
text file, of the following format:

[Event "Online Game"]
[Site "www.flyordie.com"]
[Date "yyyy.mm.dd"]
[Round "1"]
[White "player1"]
[Black "player2"]
[Result "1-0"]
[Termination "time forfeit"]
[UTCDate "yyyy.mm.dd"]
[TimeControl "1200"]

1. c4 e5 2. d4 Nc6...8. Bg5
1-0

and:

[Event "Online Game"]
[Site "www.flyordie.com"]
[Date "yyyy.mm.dd"]
[Round "1"]
[White "player1"]
[Black "player2"]
[Result "1-0"]
[Termination "normal"]
[UTCDate "yyyy.mm.dd"]
[TimeControl "1200"]

1. c4 e5 2. d4 f6 3. dxe5...25. Qd8# 1-0

There are various other termination options such as 'abandoned',
'draw', etc. My text file, now numbering about 4000 lines consists of
each game saved in this format, each game separated by a carriage
return.

Presumeably I would have to edit the text file to create fields
separated via commas?

I guess I could create a database 'chess games' with a table for each
field: event; site; date; termination; etc., correct?

What about the moves? Should I create a table column called 'moves',
in which case how to ensure data is placed in this database column? I
would also like to perform searches such as: "find me all games played
during the month of January"; or "show me the game with the fewest
number of moves"; or "how many games have I won via time forfeit?".

Yours,

-- 
Sent via pgsql-novice mailing list (pgsql-novice@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
 




 3 Posts in Topic:
convert text file to database
inpost@[EMAIL PROTECTED]   2008-04-13 07:58:31 
Re: convert text file to database
pgsql@[EMAIL PROTECTED]   2008-04-13 20:50:36 
Re: convert text file to database
nicktjh@[EMAIL PROTECTED]  2008-04-14 18:52:44 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 20 4:30:41 CDT 2008.