Inserting 100 Rows Of Data Into An Existing Table
I want to import 100 rows of data from an Excel spreadsheet into an existing MySQL table. Both the spreadsheet table, and the MySQL table have the same exact format & headers.
In MySQl Query Browser, I can locate only the Edit function, which seems to only allow me to type in the data line by line. Can I import the data in MySQL Query Browser, or do I need another product? And if I can import, how do I do this?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
SQL*plus Inserting New Row With Values = To Existing Rows Data
I am trying to insert a new employee into an empolyee table and get some of the values (namely phone no.) to be the same as what another employee currently has. This new employee is replacing the old employee, but i have to keep the old employee alive in the db as other data is reliant on its existance. I was wondering how do i insert the new employee asking the, VALUE ('etc', 'etc',) line, to assign a value to certain fields equal to the value contained in other employee rows.
How To Import Data Into Existing Rows Of A Table?
I have moved 665 records off of Filemaker into mysql-4.0.18. I had a great deal of trouble exporting a text field, possibly because it had control characters that interferred with my field delimiter (also it was from a Mac, and I'm new at this.) So I have a table called invoices and another table called tasks, that has only an invoice number and the work billed on that invoice number. To see the work billed along with the other invoice data I have to do a join, and this works but is clumsy for me. Since tasks.work is a text field of 'infinite' variety I don't see the sense of keeping it in a separate table like I would with clients' info; it belongs *in* the invoice table, not just with it. Is it possible to import this text data into a field in the invoice table? I've messed around with this but it always appends the data as new records. Perhaps I was doing an insert back then. Is the answer something like 'load data infile 'workdone.csv' into invoices (workdone);' The invoices table was filled in a certain order (by invoice number) and the workdone.csv was exported in the same order, so each invoice row should get its correct text. Is this a good thing, or am I thinking too 'flat-file-ish'?
How To Import Data Into Existing Rows Of A Table?
I have moved 665 records off of Filemaker into mysql-4.0.18. I had a great deal of trouble exporting a text field, possibly because it had control characters that interferred with my field delimiter (also it was from a Mac, and I'm new at this.) So I have a table called invoices and another table called tasks, that has only an invoice number and the work billed on that invoice number. To see the work billed along with the other invoice data I have to do a join, and this works but is clumsy for me. Since tasks.work is a text field of 'infinite' variety I don't see the sense of keeping it in a separate table like I would with clients' info; it belongs *in* the invoice table, not just with it. Is it possible to import this text data into a field in the invoice table? I've messed around with this but it always appends the data as new records. Perhaps I was doing an insert back then. Is the answer something like 'load data infile 'workdone.csv' into invoices (workdone);' The invoices table was filled in a certain order (by invoice number) and the workdone.csv was exported in the same order, so each invoice row should get its correct text.
Table Joins On Existing/Non-Existing Data
I have a question that involves a joining tables on potentially non-existing data, but we will know the expected values whether they exist or not. Say we're keeping statistics on any given number of sports for attendances over weekly time periods. There's two tables to hold data. ------------------------------ TABLE: StatisticTypes id name ------------------------------ TABLE: Statistics id statisticTypeId value date ------------------------------ Then, say, we have three entries in the StatisticTypes table for types of sports we're keeping data on...
Add Multiple Rows To An Existing Table?
I have a table named manufacturers, it has one row in right now. I want to upload all of my manufacturers into the table. Is there a way to add multiple rows to the table at the same time? If not, what is a quick way to get about 1,000 manufacturers uploaded into a table?
Import Data Via Ssh Into An Existing Table
I want to import data from several .sql files into an existing database, into one table. I tried using the following command: mysql -e [sqlfile] [db_name] But the problem was when I imported the next file, it would overwrite the previous imported data. Could anyone let me know how to do this correctly, please?
Append Existing Data In A Table
I am working on an existing osCommerce store. There are over 200 products, each of which needs the associated image file name changed. Rather than do this manually (any number of ways), I am unsure if there is a query I can run to save me lots of aggravation. What I would like to do is update whatever is in the field and change it to add the same 5 characters: The Table is Products The Field is products_image Examples of existing data in this field are: abcdef.jpg ght.jpg fire_777.jpg oops.gif (the replacement image is a jpg) The result I seek is: abcdef_th.jpg ght_th.jpg fire_777_th.jpg oops._th.jpg Logic tells me to start at the end of the data, remove the last 4 characters (.jpg) and append 5, in this case: _th.jpg Could someone please give me a hand with this? I have spent many days redoing the image files and they are nearly ready to go into a live store.
Import Additional Field Data To Existing Table
I've got my data all set-up in a mysql table and all functioning well. We have decided that we need some additional bits of data for each record and we have that data in a csv file. We've created the fields in the mysql table. In the csv file, I have the userid (to match that in the current sql table) and the additional data with the column names in the csv file matching exactly the new fields in the sql table. The additional fields in the original sql table are empty, so we can just simply write-over these fields with the data from the csv file. But...we are having problems with the import using the MySql administration tool on our server. If I select a csv file upload, I get a number of fields is not same error If I use csv load data upload, it just overwrites the first few lines of current data and doesn't put the new data in the correct fields. Can anybody help, please? If csv load data is the correct format to use, what do I put in the import tool for these variables (given that I have a standard csv file that has been created using excel) Replace table data with file (yes/no default is no) Ignore duplicate rows (yes/no - default is no) Fields terminated by(default is Fields enclosed by(default is ") Fields escaped by(default is ) Lines terminated by(default is auto) Column names (default is blank) Use LOCAL keyword (yes/no - default is yes)
Inserting Data Into Table
My task is to create a table which works as a "linker" of two other tables. In this linker table as foreign keys I am using keys from this two tables. I am inserting data into first table t1 in one loop in Perl script, then in a second loop I am inserting data into table t2 and immediately after into t3 which is a linker table between t1 and t2. I have no problems with id (primary key) from t2 , but while extracting keys from t1 there is message: Subquery returns more than 1 row after subquery: insert into t3 (t1id,t2id) values ((select id from t1 where name like 'x'),(select max(t2id) from t2)); simply because value '' are present in table t1 two times so it has two keys. How this problems can be solved? I tried to use: insert into t3 (t1id,t2id) values ((select id from t1 where name like 'x'=ANY(select id from t1 where name like 'x')),(select max(t2id) from t2)); however then there was a message:ERROR 1048 (23000): Column 'id' cannot be null because it is t1 primary key? Are there any ways of dealing with this problem?
Inserting Data Into A Table
insert into enrolls (section_id,total) values(324,max(sub) +.1); how can I make it work so the value for the total of this entry is the max of the sub column from the same table + .1?
Insert New Rows With Qty Values From Existing Rows
I am trying to make all my products unique in my db. Lets say I have a row with an id, it also has all relevant details about the product and it has a quantity value of 4. What I would like to do is take the entire row and duplicate it by the number of the quantity field. This would result in the same product 4 times instead of one product with qty of 4. Reason, I am going to serialise all the products so that they each have unique barcode from the id field. I will encounter the reverse issue when running an insert statement for inputting new data, i.e. insert a new row for each item depending on its qty value??
View That Wont Return Existing Rows
i have a problem performing simple query over view. To make it short, so anyone can recognize whether it is something im missing, this is the problem: * i have created few levels of views (some of them are based on actual tables and others are based on other created views or some mixed) * lets say the name of the view i have problems with is "aView" * when i perform "select * from aView" i get to see the view is correctly populated * when i add condition to the query above in some cases it returns ok results but in others it returns 0 rows (which is wrong) select * from aView where a=1, works fine select * from aView where a=1 or b=2, works fine select * from aVew where a=1 and b=3, returns 0 rows --- which is wrong(of course not by itself but in my case there are rows with ok values) same goes with using only the condition on b column a.) why wouldnt it fetch rows that are cleary in the view?? b.) is there any limitation on how high structure can we build using views
Add Additional Data To Existing Data In A Blob Field
I have a Blob field called "category" that we use to store different categories of job types that our users set up so they receive emails based off of the ones that they have picked. What I need to do is to add 4 new values to the beginning of each users "category" field. I am not really sure how to do this except that I might need to use UPDATE to get it done. This is where it will get tricky, I need to check for the 4 values to see if they already have them and just add the oines that they don't have. Here are the 4 values that I need to check for and add. Allied Health Care, Nursing, Rehab/Therapy, and Other/Pharmacy/Physicians. Here is what a current list of values would look like in the users table and the category column: Code:
Best Way To Get Data From Existing Database
what I'm trying to do is get data from an exhisting oracle database that is not looked after by myself but I have access to. What I want is for my MySql database to mirror the oracle one or update every 5mins or so. I have done a quick search but as I have only made simple databases before I'm not sure what to search for!
Edit Existing Data
I have just started to learn MySQL and this question might be silly. I have a MySQL table with user information. I want to edit this table in a website. I need to load existing data in a HTML form and then edit the fields and update them. I searched the net but could not find anything .
Convert Existing Data
i am working on a project and i need to convert already existing data into the mysql date format. I was told for the project that the date format was necessary. my first question is what is the advantage of having the mysql date formate which goes like this yyyy-mm-dd. the format my data currently is in is like this mm/dd/yyyy. The second question is how to convert from mm/dd/yyyy to yyyy-mm-dd
MySQL Inserting Rows Out Of Order
Using PHP, I generated a query file that has several thousand INSERT statements in it. The problem is that when I run the INSERT query, the rows are NOT added to the table in the order in which they occur in the SQL file. The first few hundred INSERTS are inserted toward the end of the table. What is the problem? The way around this is for me to resort the table based on one of the columns so the proper order is maintained. I'm using this with forum software, so it is critical that the table be in order else my boards are out of order. Is there a problem with MySQL or with me? Any ideas why rows would be added out of order?
MySQL -- Editing Existing Data In A Row
I looked through ALTER table, and some tuts over at w3schools (my heros) but I can't seem to find a way to edit EXISTING data in an EXISTING row of a table.
Append Data To Existing Cells
I have an existing table. I need a way to append data in one of the columns. How do I append data in cells so I do not overwrite the existing data already in the cells in the column? The fields in my table are `Source` , `Theswords` , `Topic` , `Subtopic` , `References` The table name is ViewNew The column I want to append is Theswords
Inserting 300M Rows From A Php Script To Mysql
I'm new to Mysql and Php and for the last week or so I'm trying to add 300 Millions rows to a table with 10 columns, the system is very slow and it stops at 200k rows after 4 hours. What I did was to generate a Php script that will automatically insert the same data to the database 300M times. Why is it so slow? Why is it that I can not get pass 200K rows? What can I do in order to improve performance? Note: Already tried to change some parameters in my.ini like........ Example: # Set buffer pool size to 50-80% of your computer's memory innodb_buffer_pool_size=70M innodb_additional_mem_pool_size=10M etc... P3 933Mhz, 640MB SDRAM, 30Gb hd
Amending A Hierarchical Structure On Existing Data
I want to amend my table such that the following... SELECT * FROM words; +-------------+------+------------+ | root/parent | pos | word | +-------------+------+------------+ | abandon | Verb | % | | @ | @ | abandon | | @ | @ | abandoned | | @ | @ | abandoning | | @ | @ | abandons | | abbey | NoC | % | | @ | @ | abbey | | @ | @ | abbeys | +-------------+------+------------+ would instead read... SELECT * FROM words; +--------------+------+------------+ | root/parent | pos | word | +--------------+------+------------+ | NULL | Verb | abandon | | abandon | Verb | abandoned | | abandon | Verb | abandoning | | abandon | Verb | abandons | | NULL | NoC | abbey | | abbey | NoC | abbeys | +--------------+------+------------+ Thus dispensing with the need to rely on the table's natural order, but I'm a bit stuck as to how to go about this. I'm happy to add a numerical key to the table if it makes this process easier. In my mind (not an especially logical place) the logic is something like this: if parent is not "@" set var_parent = parent and var_pos = pos else set parent = var_parent and pos = var_pos finally delete from words where word = "%" But how do I turn that into something useful?
Duplicate Existing Database (innodb), Structure Only, Without Data
There's a database (innodb) named "test1". I want to create a new database with exact the same strcuture, but since there are many tables in this db i do not want to retype the whole commands. I'm looking for a possibility to duplicate this database, any ideas / tools?
How Do I Generate Data Definition Statements For Existing Tables?
I cannot remember how to generate a create statement for an existing table. I tried searching the documentation but I don't think I'm searching for the right text. I'd also like to know if there is a specific name for this task and what section it is under in the docs.
Migrating Data Into Existing Mysql Schema Tables
i understand how to migrate data into mysql and to use the migration tool to convert a database to a mysql schema, however, I'm not sure I understand how to migrate specific data tables/columns in the source file to specific tables/columns in the destination mysql tables (where the schema already exists and I'm simply importing data itself).
How To Add A New Row To An Existing Table?
I am able to create database, tables, inserting values, and so forth. My question is this: Let's say I have a table on the list of items I owned, and some time later, I need to add a new item between after row 12 and before 13. How do I do that? I did look at MySQL 5.0 Manual and didn't find anything similar to what I wanted to do.
Insert Row Into Existing Table
I have a table with rougly 70 threads, I now need to go back and insert a couple new entries into my table, but they cant go at the end, they need to go in the middle, say like ID 40,41,and 42. How do I do this?
Copy Of An Existing Table
MySQL: How I make a copy of an existing table in phpMyAdmin or SQL ? without copy data with copy and data
Assigning Userids To Existing Table
I have a table of existing users in a database. I want to add a "userid" column to the database that automatically assigns an ID to each user when new accounts are added to the system. I know I would do something like this if I had the brains to have added the column at the time of creating the table: ALTER TABLE writers ADD ( userid int PRIMARY KEY auto_increment ); However, the table is now already active with users, and I want userids assigned to existing accounts on the system.
How To Add A Auto_increment Field To An Existing Table
I want to add a field called "id" starting from 1 and auto increment, but it seems that mysql doesn't allow me to do the following. alter table existing_table add id INT AUTO_increment; Message: Incorrect table definition; there can be only one auto column and it must be defined as a key. But I don't have a key or auto column in the existing_table.
Adding A Foreign Key Into An Existing Table
May I know how should I do that? The SQL statement should be: CREATE TABLE USER_SYSTEM_SECURITY ( USERID VARCHAR(32), HOSTID VARCHAR(32), HOME_DIRECTORY VARCHAR(32) NOT NULL, ACCESS_RIGHTS INT(3) NOT NULL, PASSWORD_EXPIRY_DATE DATE, ROLES VARCHAR(32) NOT NULL, PRIMARY KEY (USERID, HOSTID), FOREIGN KEY (USERID) REFERENCES MEMBER (USERID) ON DELETE CASCADE, FOREIGN KEY (HOSTID) REFERENCES SYSTEM (HOSTID) ON DELETE CASCADE); But I forgot to add in the last row during the table creation.
Search Table Column For Existing Value
I would like to search a table's column so that I can match an entered email address against the data in that column. I'm writing an aplication for an event and I don't want duplicate email addresses in the table. I'm using PHP4.
Auto Increment Existing Table
I have an existing table with many rows of data. I want to add auto increment to it so I do not have to manually asign each row a unique record number.
Inserting Data
Everytime I insert data into a table, The rows are rearraged so the primary key column is in alphabetical order. How does this happen? and how do I fix it?
Inserting Data
if I want to insert data into two tables how do I do this? Is this right? I'm guessing not as it doesn't work What should I do? $query = "insert into requests (word,status) values ("$req","pending") AND insert into known_by (word,user_name) values ("$req","$user_name")";
Inserting New Data
I have a form that has name, address, city, state, zip. All this goes into a single table. I want to add an additional table to put the cities into. I want to pull the cities from the city tables into a dynamic dropdown to choose the cities from.My problem is if I have a city already in the city table, I dont want to add it again and have duplicate citys in the dropdown. Anyone have a clues on how I would do this?
Inserting Data
I'm trying to do something like this CODE$query="INSERT INTO ".$table_name." ('catagory', 'link', 'link_description', 'link_title', 'link_name',) VALUES ('', '".$link."', '', '', '') WHERE catagory=".$catagory."";
Modifying Primary Key And Auto_increment In Pre-existing Table
Given the tables defined below, is there a sql statement that could make num_1 an auto_increment field without rebuilding the table (nevermind any potential numbering conflicts)? I don't see anything in the alter table documentation that will produce this effect. Also, say I wanted to change the primary key of test_1 (e.g. primary key(num_1,num_2)). I think because num_1 is a foreign key for the table test_2 MySQL grumbles about changing the primary key, in addition to dissalowing the drop and redefinition of the primary key. Could anyone tell me how to easily handle these situations? This is a simplified example of my actual situaion, but if it can be solved here then I think I would be OK. Code:
Inserting Multiple Items (# Unknown) Into A Table Using Primary Id From Master Table
In my database I have a master table for products using a auto-num id column. One product may have several purchase options (items) which have to be entered into another table. To enter a new product and items I use a form that gathers the information for the master product and one item. This information is then inserted into the database. For the items I use mysql_insert_id() to get the id into the items table. My challenge is getting this same id for additional items. Once the user has input the initial product and first item they hit a submit button to call a form for adding any additional items, and this is repeated until all items for that product are entered. The new items are inserted into the database okay, but always with an id of 0. The mysql_insert_id() no longer works. Is there a way to pass this id from the previous insertion to the new one by passing a variable? or echoing input type"hidden"? Or even better yet, Im wondering if I can ask the user at the time of entering information for the product how many items that particular product has and then bring up that many form fields to enter multiple items? Can this be done using something like an incremented loop to call form fields?
Problem Inserting Data
I'm having an issue inserting data into a MySQL database using PHP code which has worked before. Some of the fields in the form have been removed and so are not passing data across to the insert script and the insert has been altered to show this, apart from that everything is the same. Could anyone help me diagnose what is going on this code to not make it work, I've been looking for the last 2 hours and just cannot find the problem. Data entry page PHP <? if(isset($_GET[submit])){ $error='' if ($_GET['heightcm']=='') { $height=($_GET['heightinches']*2.54); } else { $height=$_GET['heightcm']; } if ($_GET['widthcm']=='') { $width=($_GET['widthinches']*2.54); } else { $width=$_GET['widthcm']; } if ($_GET['depthcm']=='') { $depth=($_GET['depthinches']*2.54); } else { $d
Trouble With Id + 1 When Inserting Data
I'm trying to find a good alternative for auto_increment, the reason is that I need to know what the next value of id will be before inserting data into the table and I haven't found a relyable way of doing that with auto_increment. My plan was to use a commend like: INSERT INTO temp (id, test) VALUES (MAX(id)+1, 'foo') But I am getting the error: ERROR 1111 (HY000): Invalid use of group function.
Inserting Dynamic Data?
In the connectorJ example: stmt.executeUpdate( "INSERT INTO autoIncTutorial (dataField) " + "values ('Can I Get the Auto Increment Field?')", Statement.RETURN_GENERATED_KEYS); it works perfectly fine for static text. I can't seem to figure out a way to get it to accept dynamic data (from java beans etc) i.e. mybean.getA(), myBean.getDate for example: "values ('Can I Get the Auto Increment Field?'" + getA() ) gives me a compilation error. What's the proper syntax?
Inserting VB Data Into MySQL Using Ado
I am trying to insert some data into a MySQL db, with Visual Basic by using ADO. I can select data without a problem using adorecordset.open, to insert would I use adorecordset.addnew? if anybody has done this and has a sample script I would be very happy to check it out.
Problem In Inserting Data
I have a table with 8 fields ,,in which one PK and two indices ,, now I want to insert a new data , and to avoid dublication I want to check the two indices together IF they are equal to the similar fields in the coming data , I want to remove the existed or update it completely (changing all the fields) , so I tried using INSERT.....ON DUBLICATE UPDATE .. it will check only the PK or one index then give you the chance to update one field ..(that what I understood about it). another way is , using REPLACE , but also it only checks the PK ... I dont want to check the PK.. it is only (AI) auto increment number HOw to do it saying like this : INSERT INTO mytable (A,B,C,D) VALUES (A1,B1,C1,D1) and IF the stored A == the coming A AND the stored C==the coming C THEN delete the existed or dont insert this row
|