MySQL 5 has a CSV storage engine
You can read Page 639 of the MySQL Administrator's Guide and Language Reference 
(2nd edition)
ISBN 0-672-328700-4

Try this:

Step 1:
CREATE TABLE NewDataCSV (firstname varchar(30),lastname  varchar(30)) 
Engine=CSV;

This should create NewDataCSV.frm and NewDataCSV.csv in the datadir of MySQL
You can insert into the Table with INSERT INTO NewDataCSV VALUES (...);
CSV tables do not support indexes. All queries against this table is a
full table scan every time. You may want some speed when searching.
So, create another table with same structure as the CSV table, like the 
following:

Step 2:
CREATE TABLE NewData (firstname varchar(30),lastname  varchar(30)) 
Engine=MyISAM;
Now you can create indexes against NewData.
ALTER TABLE NewData ADD INDEX name (lastname,firstname);

Step 3:
If you already have a CSV text file called alanmadsen.csv on a floppy,
just do this after you ran 'CREATE TABLE NewDataCSV ...':
copy A:\alanmadsen.csv NewDataCSV.csv

Step 4:
After doing all this, now load NewData from NewDataCSV as follows:
INSERT INTO NewData SELECT * FROM NewDataCSV;

If you want to load a larger CSV file a month later, do this:
DROP TABLE NewDataCSV;
DROP TABLE NewData;
Then repeat Steps 1-4

As far as the methodology to access the CSV file in PHP
it works the same way as with other table engines.
Make all requests for data from NewData not NewDataCSV.

----- Original Message -----
From: alan <[EMAIL PROTECTED]>
To: mysql@lists.mysql.com
Sent: Monday, October 9, 2006 10:35:54 PM GMT-0500 US/Eastern
Subject: hello everyone


my name is alan madsen.

while i am very well grounded in complex systems and database
management that is archaic by today's standards, i am looking
at a creating a server-side php/mysql environment for a very
simple database application with only the experience of recent
light reading and knowing that i've successfully installed a wamp
serverkit on windows 2k (uniform server) that includes mysql5:

    The Uniform Server is a lightweight server solution
    for running a web server under the WindowsOS. 5.79MB!

    It includes the latest versions of Apache2, Perl5, PHP5,
    MySQL5, [and] phpMyAdmin

    http://sourceforge.net/projects/miniserver/

running on a laptop, i've seen this installation's instance of
apache serve web pages to the net.

very nice.

i'd like to create, load, and maintain, a mysql database table
containing fewer than 8,000 records, each with 5 fields (rows?)
- lengths ranging from 10 bytes to 80 bytes - of character data,
one field of which would be used as data and as a isamkey (com-
pound keys would be nice, but they are not necessary).

assuming a working installation of mysql5 and that a csv data file
exists, will someone outline what steps are necssary to: 1. create
such a table, 2. load it, and 3. the mysql methodology to access it
via php/mysql_isam?

any comment would be appreciated.


regards,



Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to