问题
I receive data in a CSV (kind of) format, in which each entity is represented by multiple sections of different record groups. In this fictitious example (below) I represent a number of colleges (the entities) by a number of sections of different record groups (these can be thought of as the tables). I have no control over the format of this incoming data. So I was wondering, when issueing a query on incoming CSV data using the H2 Database engine, can you somehow specify which line to begin at based on some kind of pattern to identify the first line of each table for a given entity? The fictitious data is below.
NEWCOLLEGE
ADDRESS|HOUSE_NO|STREET|TOWN|CITY|COUNTY|COUNTRY
DATA|51|Hill Road|Reading|Berkshire|United Kingdom
DATA|78|Crescent Road|Wallingford|Oxfordshire|United Kingdom
DATA|5|Bonny Crescent|Swindon|Whiltshire|United Kingdom
COURSES|NAME|DESCRIPTION|CODE
DATA|Sketching Life|Sketching from live examples|434
DATA|Gardening|Teaching how to plant a variety of shrubs|546
KEYDATA|COLLEGE NAME|DEPARTMENT
DATA|Witney College|Life Skills
LECTURERS|NAME|COURSE|EMP_ID|DATE_OF_BIRTH
DATA|David Kew|Sketching|3434535|03-04-1951
DATA|Mary Coldridge|Gardening|5352346|15-04-1969
DATA|Henry Cunnings|IT Basics|4354364|12-12-1971
NEWCOLLEGE
.... and some more tables for another college
回答1:
Currently this is not possible out of the box. The data would need to be pre-processed (split into multiple files).
来源:https://stackoverflow.com/questions/8067343/can-h2-database-query-a-csv-file-containing-multiple-sections-of-different-recor