convert text file to database
От | e-letter |
---|---|
Тема | convert text file to database |
Дата | |
Msg-id | 298a6f60804122358k1f7c034ev8115f7dbe3f78531@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: convert text file to database
Re: convert text file to database |
Список | pgsql-novice |
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,
В списке pgsql-novice по дате отправления: