Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




Easy Way To Enter 20000 Records To Mysql Db


I'm looking for the easy way to enter a lot of information to Mysql Db for me the best way is like in access you just paste the buffer (from excel) to the table you selected and it does it.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
MySQL - Not Able To Enter 0 In The Database ?
Well I am trying to enter 0 into the table(from front end) but it is giving error. Surprisingly, I am able to enter any other value.

The field's type is INT and I tried all combinations of making it NULL and not NULL. I have also made the datatype Float as well varchar but still, it is not accepting 0. WHenever i enter any other value than 0, it easily accepts it.

I know what is going on but the problem is, I don't know how to fix it ? I am sure there will be few others who might have faced the same problem.

Enter A Into Mysql Database
created a website text field that needs to enter a number of slashes, but
mysql throws errors.

any ideas on why? and how to enter into a database?

MySql To Prompt A User To Enter Input
Is there anyway in MySql to prompt a user to enter input and have it populate another table?

Quick & Easy MySQL Sync?
Does anyone know of any quick and easy way to sync a local development mysql server to a remote server and back. I'd like to be able to optionally sync either direction?

Enter Null As Value
i have a dropdown box with the first box's value as "null" if they do not select it. However, when i enter the value into the db through query it returns it as 0. is there anway so it is null in the db?

How To Enter Unicode Strings?
How does one enter Unicode strings into a 5.0.3 MySQL table?

I tried things like:
INSERT INTO tablename(colname) VALUES( _utf8'€©®á§A¦n')
But this doesn't work. I guess I need an escape sequence, but the MySQL
manual doesn't specify Unicode escape sequences, just for quotes,
newlines and such.

Enter Exact Date
I have a form which the user enters the date automatically. Instead I wanted to make it show the date that submit was hit which would eliminate the enter date part of the form.

Like
----------------------------------
Alias --> Date (show date that submit was hit instead of enteringt it manually
News
----------------------------------

Enter Parameter Value Request
I keep receiving a request to enter paramerters value, even when I remove the where or order by expressions. What should I look for that would prompt this?

How To Enter Same Data All At Once Into The Tables?
I want to upload a certain graphic file to all the tables in my MySQL database. (The file will be uploaded into a certain set of cells in all the tables). What is the easiest way to do this using phpMyAdmin? Is there a specific SQL statement or something?

Can't Enter Chinese Characters
I have tried to follow instructions online as well as other threads in this forum, so far to no avail. I am using JSP, Java 1.4, MySQL 4.1 and Tomcat 5.5 on Windows XP.
1) I have set my JSPs to use UTF-8 wherever possible. I have a form where I can enter Chinese characters into a form, which hits a servlet, but text always arrives to the servlet garbled.
2) When I try to directly do an INSERT to a column and insert a chinese character, it comes up as ??? mySQL Query browser says "Data truncated to column 'translation' at row 1' ErrorNumber 1265.
3) I have made sure that each table's encoding is UTF-8.
Not sure what else to do. I can't find any easy instructions to do this. If you know of one,

GUI Tool To Manually Enter Data
I have to manually enter some data into a mySQL database. Is their a GUI tool to do this?

Enter Null In A Blank Field
How would I enter a Null in a blank field from a query.  I have several fields in a table that may or maynot have information in them.

I need to export all those fields, I want to have all the blank fields filled with Null so that when I export the table info I can change the Null to another value.

Help With A (probably) Easy Query
I am trying to write a query to run through phpmyadmin. What I have is this:

In table "vb_user" I want to pull the data in field "username" and copy that username in another table called "vb_userfield" in a field called "field5". Both tables share the field "userid" which is how the relation is made. I know this is probably very simple but man... I just can't seem to pull it off.

I've got about 500 members and I really want to populate that field "field5" with thier username without having every one of them doing it manually.


Easy Query...probably
I've got three tables:

- events
- tasks
- docs

Events are made up of one or more tasks and tasks may or may not have docs.

What I need to do is get all the events with associated tasks and docs.

QUICK AND EASY ONE
im fairly new to php/mysql so please bear with me
I am trying to upload a txt.file created from an excel spreadsheet using the following query:

LOAD DATA INFILE 'path/file.txt' INTO TABLE my_table;

im getting a syntax error!
what could be wrong? are there any other attributes i should be adding to this query? i also tried uploading a csv version of the same file and get the same error.

Unable To Enter More Than 255 Characters Into Comments Field
We migrated a clients old server to new hardware; they have a vert app that runs on a MySQL backend.

We have the app up and running however, whenever they try to enter more than 255 characters into the comments section of the apps maintable it returns the following error and will not save

Bind parameter value for ':3' is too big (320)

No changes made to database.

UPDATE maintable SET RecordID = ?, ComputedShow = ?, Comments = ? WHERE RecordID = ? AND NR_key_name = ? AND ComputedShow = ?

I am not very familar with MySQL but we have enabled longtext on the comments "field" in the table, the problem still persists. Anyone have any idea where to start on this one?

Easy Way To Delete Duplicates?
I had 2 membership db's. One had all the members (65K) db2 had all the members that have registered on the website. I am wanting to consolidate the two.

Basically i took both, and merged them together into their own db. now the membership list is about 80k. 20k or so of that are duplicates. My idea was to export the thing as .xls and remove the duplicates via Microsoft Excel. However, Excel has a limit of 65Kish rows. so i can't really go about that.

Select Row From Table, EASY
I'm drawing a blank and can't find it my Sams 24 hour book.

I've got a player name and stats in a DB so a row in the database would look like
Chris Brown 300 1200 5 40 325 2

I need to select(display PHP) Chris Brown and everything associated with him.

I had this all setup and haven't thought of it in years and now....geesh I just feel like an idiot as nothing I've tried works and I know it's connect to DB then one line of code, a select statement.

Pros/cons (easy ?)
Say you have a double opt in mailing list, of which the subcriber list is
store in the db. Im still somewhat of a newb, so bear with me... are there
any pros/cons as to keeping the 'unverified' subscribers in a different
table, aside from organization?
I did just that, where, when they subscribe, they are put in a temp table,
and them moved to the real table once verified (and the temp entry deleted).
At the time, I did this thinking organization of data... but as an
afterthought, am thinking I just did a lot of unecessary coding... ... and
am thinking just an y/n field for verified or not in the primary table would
suffice.

It's not actually a mailing list, just thought that'd be the easiest
example.... the main table holds about 1000 entries, and there about 10-20
temps/days. The only con to my setup I can think of (again, as an
afterthought) is deleting the unverified entries after a week and the extra
resources of going through the entire db searching for the week-old
unverifieds, but with the size of my db, I dont even think that is a con in
my case.

Did I waste a lil time there w/ the extra table?

Create User Easy?
Is there an easy way I can just create a MySQL User... and give him the privledges to only do things to databases that he from now on creates..?

Or is it gonna be every time I create a database I would have to give him privledge to that database? What type of route would I have to go with that...

Also when his user connects to the MySQL Server is there a way I can do a SHOW DATABASES and show only the databases that he has created? He needs to also be able to Create/DELETE/APPEND/UPDATE any database that he creates.

What's the easiset way about going around this route? Am I going to have to Grant him Permissions on every database that he creates? Does the root account have to grant the permissions?

I Think It's An Easy To Fix Sql Syntax Problem
can anybody help me :

@mysql_query("INSERT INTO leden WHERE gebruikersnaam = ".lekubb($_POST['gebruikersnaam'])." (status) VALUES (Global Admin)") or die(mysql_error());

Ik get this error :
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE gebruikersnaam = t (status) VALUES (Global Admin)' at lin

You can see the script online at http://www.webmasterhelp.be/systeem/testje.php
When you fill in something and press enter you'll see the error.
If you need more info or something you can mail me at arne_dejongh2@hotmail.com or post something here.

Easy Collation Changing.
A while ago, I messed around with collations etc, without understanding the rammifications.Ended up with some tables swedish, some general and others, but all were under Latin1. After some time a few queries started breaking. Anyway, I played and tinkered and eventually managed to fix.
The problem was that I couldn't go and Alter thousands of columns manually, so a PHP script was created, and works fine.
But for the sake of knowledge, is there a way to change the Character Set and Collation stuff of an entire database(s) quickly and easily using SQL?

After A Syntax Error: I Get Thid Odd Prompt And Can't Enter Any More Commands.
My trying to paste CSV data into my dataBase sometimes the pasted data creates errors. After that my prompt looks like this: "> then I'm not able to enter any commands, the "> prompt keeps repeating every time I hit "enter" I have to shut the window and restart MySQL.

How To Enter Iso-8859-2 Characters Through Command Line Client?
We're trying enter polish language into mysql. My understanding is that
polish language uses iso-8859-2 character set. I am cutting and pasting
polish text from a web browser (Konqueror) into the mysql command line client
running in a terminal window (konsole). MySQL server is version 4.0.12
running on a remote Linux server that I have connected to with ssh.

When I paste polish characters into the command line client using a very
simple insert statement a lot of characters are being lost or converted to a
question mark (?) ... I believe this is happening to all non-ascii
characters. The database server must support both English and Polish so
anything that we do must be specific to the individual database (at the
most).

I have tried passing various options to the command line client, here is an
example (line split for readability):

mysql --character-sets-dir=/usr/share/mysql/charsets
--default-character-set=latin2 -u user -p database

I have also tried playing with Linux locale settings by starting mysql like
this:

LC_ALL=polish mysql --character-sets-dir=/usr/share/mysql/charsets
--default-character-set=latin2 -u user -p database

Nothing quite seems to work. What does work fine is inserting the characters
through a web interface. As well as in my purely Linux environment, we also
need this to work when on a Microsoft Windows based desktop.

Quick And Easy Update Query? Or Not Possible?
I need to do a global change to a column in my database. I know this is poor planning on my part, but I recently made a change to all of my image extensions for speed purposes.

I have a column called thumbnail_path, and every value ends with .GIF. I would like to change them to all end in .JPG. How can I do this? Is this even possible to do in one update query? or will I need to select, parse w/ php and then update?




Sql Virgin. An Easy Question For U Experts Im Sure
Im a database virgin, i would like to know more but find it quite confusing, although im sure its not!

Im setting up a cms and have installed wamp on my machine and its working. Now the cms has asked me to create a sql database so ive gone to php my admin and put a name in the creat field and created it. Its showing in the left field of phpmy admin.

Now the cms is asking for the name of mysql login and mysql passwoord!

Where the hell do i find that? ive never created one!

Easy Question Re: Type Sizes
Just wondered, what exactly does:
int(11) do
does that mean you could store UP to an 11 digit number in the field?
ie. 01234567890
with the highest possible number:
99999999999

and does the same apply to tinyint and all the other int types?

if that is the case, why would one chose tinyint(1) over int(1)?

and also I guess the same goes with text/varchar types.

Easy Way To Get Time Zone Offset
I need to get the standard offset value from GMT for any given time zone name in the mysql.time_zone_name table. Is there an way in MySQL to do this?

For example:
I have 'US/Eastern' time zone. I know that the value I'm looking for is -5. How can I get this out of MySQL. I don't care about DST offset, just standard time offset.

Another Easy(for You, Hard For Me) Select/join
Table 1 indexed on ID.
Table 2 is a chat log. Colums: From, To

I'd like to find out who is NOT chatting.
So, I'd like to select all ID in Table1 that are NOT found in either column From or To in Table2

So far I'm using two selects, but this doesn't seem right.

How Do I Employ This Easy Access Query Technic
I Access it is very easy to build queries off of queries built of of even more queries.
with only a few certain limitations it works quite well and is easy in the Access Graphic interface.

I am completely self taught in Access so while I can build an entire enterprize application from scratch, I am a little sketchy on some of the technical terms. I think what I am doing in Access is called "layered" queries.

HOWEVER, whatever you call it, I am not so certain I'll be able to enjoy the same functinality with the MySQL database I have recently be asigned to admin.

First of all, the database, while in MySQL is accessed (for me) only through an interface in the UBB Forums SQL Commands control panel.

Secondly, while I can write and save standard text SQL queries, HOWEVER the saved queries are not necessarily saved with a certain name and do not appear to be able to be referenced in other queries. The saved queries are in a seperate table. As a side note, I can tell that the previous admin knew, or did even even less than I becasue the index key for my very first saved query was 1.

sigh....

Anyway, becasue the site owner has not added my email address to the contact info for the site's web host, I do not have access to the main MySQL control panel in the home folder. I only have access to the forum tables through the UBB Threads control panel.

I am considering attempting to make some tables to use in place of the layered queries, however I am uncertain if they will be in the same folder and thus if I'll actually be able to access them through the UBB Threads control panel.

However, I am wondering if anybody can share with me anything I might be missing as to how I can, or even IF I can layer queries in MySQL.

An example of what I want to do is this:

Desired result is to know the count of posts by hour of the day, filtered by Year and by month, BUT ONLY GROUPED BY HOUR OF DAY.

In Access, I could easily build a first query that filters the posts table to the year and month(s) desired, and then build my 'Group By Hour/Count of Posts' query off of it.

Short of actually creating a new table with the filtered data, can anybody share with me how I might be able to do the same thing in MySQL?

Easy SELECT With OR Takes A Very Long Time
We've got a database with about 1000000 books. A query in the table
BOOKS for the TITLE 'java' is very fast. We have a fulltext index on
the column TITLE.

However, if we want to do a exact same query and include the rule that
the book with ISBN '0131016210' always should be included - then the
query take several seconds to finish:

SELECT * FROM C_BOOK WHERE MATCH(NAME) AGAINST ('java') AND (ISBN LIKE
'0%' OR ISBN LIKE '1%') OR ISBN = '0131016210'

ISBN is the PRIMARY KEY.

Is there anything I can do about this?

Easy SELECT With OR Takes A Very Long Time
We've got a database with about 1000000 books. A query in the table
BOOKS for the TITLE 'java' is very fast. We have a fulltext index on
the column TITLE.

However, if we want to do a exact same query and include the rule that
the book with ISBN '0131016210' always should be included - then the
query take several seconds to finish:

SELECT * FROM C_BOOK WHERE MATCH(NAME) AGAINST ('java') AND (ISBN LIKE
'0%' OR ISBN LIKE '1%') OR ISBN = '0131016210'

ISBN is the PRIMARY KEY.

Is there anything I can do about this?

Very Easy Question - Assigning A Base A Username And Password In PHPmyadmin
Maybe I am just getting very tired all of a sudden, but I have forgotten how to assign and username and password to a MySQL base - can someone please put me out my misery on how to do this

How Do I Rewrite A Slow Subquery Into A Fast Join? (Prolly Real Easy For A Non-noob To Answer)
I used subquerys because they made more sense to me, until the table got "a lot" of data in it (not really... just 1000 entries) - then all querys including subquerys slowed down to 4-5 secs EACH!! :) This is insanely slow.

What I am doing here below is looking into what messages a user has already read in the subquery, so that none of the ones he already has read will EVER again show up for him.

So, how do I rewrite this subquery:

NOT IN (SELECT reffen FROM $readt WHERE sender = $nr)

From this entire SELECT:

SELECT halfref, brokensms, DATE_FORMAT(arrived, '%y'), DATE_FORMAT(arrived, '%m'), DATE_FORMAT(arrived, '%d'), DATE_FORMAT(arrived, '%H'), DATE_FORMAT(arrived, '%i'), priv FROM $halft WHERE sender = $nr and halfref NOT IN (SELECT reffen FROM $readt WHERE sender = $nr) order by id desc limit 1

Into a faster join of some sort?

I'd aprichiate if you told me what each part of the rewrite actually does, because I been reading about joins for a day now and still don't get them at all!

Return 1 Row With Concatenated String (was "Really Easy But My Minds Gone Blank")
I'm creating a website for my local American Football team and the database structure is as follows:

CREATE TABLE players
(
`PlayerId` tinyint unsigned NOT NULL,
`Jersey` tinyint unsigned,
`FirstName` varchar(12),
`LastName` varchar(20),
`ContactNumber` varchar(12),
`Email` varchar(40),
PRIMARY KEY(`PlayerId`)
);

CREATE TABLE playerposition
(
`PlayerId` tinyint unsigned NOT NULL,
`PositionId` tinyint unsigned NOT NULL,
PRIMARY KEY (`PlayerId`, `PositionId`)
);

CREATE TABLE positions
(
`PositionId` tinyint unsigned NOT NULL,
`PosAbbr` varchar(3) NOT NULL,
`PosLong` varchar(30) NOT NULL,
PRIMARY KEY (`PositionId`)
);
Now each player can play a multitude of positions say PlayerA can play QB, RB and TE. My query is as follows:

SELECT pl.PlayerId, Jersey, FirstName, LastName, PosAbbr
FROM players pl, playerposition pp, positions po
WHERE pl.PlayerId = pp.PlayerId
AND pp.PositionId = po.PositionId
Now it will return 3 rows for PlayerA, 1 row for each position they play. What I want it to return is 1 row with a concatenated string of their positions something like QB/RB/TE. My mind has just gone blank. Can anybody enlighten me on this.

P.S. I'm running 4.1 on the server.

How Do You Enter An Entry With A Newline Inside The Entry?
I'm trying to enter an entry into the table. However, my entries must have newlines inside each entry. Further more, i'm trying to do this from an excel file(ie. first by saving it to a text file and then using LOAD DATA INFILE..).

Register The "enter"
Currently i have a form for user to upload news, which is then inserted into the db as a blob column. I would like it to register it when user presses enter (instead of having them type <br>), but whatever I do, it just outputs as a bunch of text with no spacing whatsoever.

Cannot Enter "Structure"
I cannot enter"Structure "

MySQL said:

#1 - Can't create/write to file 'C:WINDOWSTEMP#sql_8e8_0.MYI' (Errcode: 2)

Count Related Records, But Show Records With NO Related Records Also
cl_items
========
it_id (pk)
it_ownerid
it_name

cl_offers
========
off_id (pk)
off_itid (fk) -> to it_id
off_whoid

My query needs to output ALL of the records in cl_items AND still show how many offers are on each item (from cl_offers)

I can't get what I want through the GROUP BY because I want to show the records in cl_items which DO NOT have any offers on them yet also.

Is there any way to do this with mysql only?

All Records From Table A - All Records From Table B - Join Alike Records
I am by no means a SQl Jedi as will be apparent by my question, but I
can usually figure out a select statement on my own. I have one today
though that really has me stumped. I am working in MySQlL 5.

In My first select statement I get all my records from Table B
SELECT
`table_A`.`ITEM`,
`table_A`.`DECSCRIPTION`,
`table_A`.`UM`,
`table_A`.`PHASE`,
`table_B`.`Qty`,
`table_B`.`Calc` as calculated
FROM
`table_A`
Inner Join `table_B` ON `req_itemlist`.`ITEM` = `table_B`.`ItemID`

In my second statement I get my records that match in this case phase
401 in Table B and all my Table A records for phase 401.

SELECT
`table_A`.`ITEM`,
`table_A`.`DECSCRIPTION`,
`table_A`.`UM`,
`table_A`.`PHASE`,
`table_B`.`Qty`,
`table_B`.`Calc` as calculated
FROM
`table_A`

Left Outer Join `table_B` ON `req_itemlist`.`ITEM` = `table_B`.`ItemID`
Where
table_A.PHASE In ('401' )

Now I need to combine the Data of both recordsets. I need EVERYTHING in
Table B, but I also need All Table A records that match the phase
selection....

Can I write this one query or do I need to use a Temp table?

Delete Records Without Matching Records
I have a one to many relationship in my database. I would like to delete records in one table if there are no matching records in another table.

1 Mil.+ Records Ok For Mysql
this may be a dumb newbie question, but I didn't have any db with such massive content.
I need a DB to hold more than 1.000.000 records with various information and details.
The mysql DB (4.03) runs on a server along with an apache installtion to serve Web requests.
Is mysql able to handle this amount of data???

Keep Only 50 Records In MySQL
Does anyone know how to keep only 50 records in a database table?
Can mysql automatically do this or do I have to write php to do it for it.
i.e. if there are the id goes from 23 - 53 when a new row is added it gets id 54 and id 23 is deleted?

How To Get Last Week Records In Mysql 3.0.x
How can I get all records relating to last week from a table . I am using Mysql 3.0.x.

How To Exclude Particular Records In MySQL?
My PHP script has a SQL statement as shown below that works fine, but it is slow and inefficient. I need to speed it up by using one sql statement instead of using the sub-query.

The solution I need is to eliminate the use of the NOT IN clause ie

SELECT DISTINCT CONCAT(fname,' ',lname) AS realname, staffid
FROM staff
WHERE team = 'umi'
AND staffid NOT IN (SELECT staff.staffid
FROM staff, calendar
WHERE calendar.staffid = staff.staffid
AND calendar.type IN ('arl','lsl')
AND (calendar.start BETWEEN '$begin' AND ADDDATE('$begin', 6)
OR '$begin' BETWEEN calendar.start AND calendar.end)
)

where $begin is a PHP variable that has a value like this '2007-11-20" etc. What I want is that it excludes staffid that is already defined in the calendar table by start and end fields. I tried to make it more efficient, but I could not solve.

Editing Records In Mysql
I have downloaded the MySQL Administrator and MySQL Query Browser GUIs for Windows.  What I really want to do is just edit records visually without having to type SQL queries.  I thought for sure one of these two programs would allow me to do that, but I don't see where. 

I see how I can access databases ad and edit table information, but I don't see where I can go into a table and actually ad or edit a record without having to type SQL commands.  Am I missing something, or is there some other free program available that will allow me to visually edit records (that is, from Windows...I don't want to use phpMyAdmin)?  I can't imagine something like this doesn't exist for such a great database system as MySQL.

Maximum Records In MySQL
What is the maximum record capacity in MYSQL. Is it in thousands or millions.

OR what is the actual limit.

Records MySQL Support
i'm doing my research on mysql. but i can't find how many records in 1 table mysql database can handle??

Records MySQL Can Store
How many records MySQL can store?& How many records Access can store?


Copyright © 2005-08 www.BigResource.com, All rights reserved