[RLUG] database question
Joshua Simpson
std3rr at gmail.com
Tue Jan 23 16:15:11 PST 2007
On 1/23/07, Dennis Bagley <dbagley at 775.net> wrote:
>
> Hey folks,
>
> I have an ascii database containing approximately 190,000 records.
I assume you mean a CSV or other character delimited flatfile?
I need to import the data into a dbms, trim out fields I do not need and
> extract about 10,000
> records.
Any particular DBMS you have interest in? PostgreSQL has the COPY command,
MySQL has the LOAD DATA command.
For example, if I wanted to import the following CSV into PG:
1,josh,"Some programmer"
2,jon,"Another programmer"
I would do a :
# Create the table for storage:
CREATE TABLE some_table (id integer NOT NULL PRIMARY KEY, name varchar(20),
desc text);
# import the CSV file
COPY some_table FROM '/path/to/some_csv.txt' DELIMITERS ',' CSV
You can include specific columns you wish to fill. If you wish to remove
columns from the CSV, you can easily use `cut` to do so.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rlug.org/pipermail/rlug/attachments/20070123/09d23e84/attachment.html
More information about the RLUG
mailing list