473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

possible to shift and splice colums?

In MYSQL is it possible to shift and splice colums?
say I have a table w/fields: name | tele_num | age
and I get all the addresses later - address initally
stored in a txt type file with 1 rec /line.
I now want: name | address | tel_num | age
Can I do it this? if not can I do:
name | tele_num | age | address ?

Just need the tools cmds to use and the "flow"
you don't have give the actual SQL unless you want.
Thanks,
Lee G.
Jul 20 '05 #1
1 1704
leegold2 wrote:
In MYSQL is it possible to shift and splice colums?
You're asking about adding a column to a table, right?

See this page:
http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html

and maybe this page:
http://dev.mysql.com/doc/mysql/en/Loading_tables.html

But matching up the addresses to the right records is a perennial
problem with data loads. I don't know of an easy way to do it. There's
no SQL syntax for UPDATE to say, "update the address field with value X,
one record at a time, for records matching the person's name Y."

The best thing I can suggest is to write a script in your favorite
language, loop through your text file of addresses, and execute a
separate UPDATE statement for each line:
UPDATE MyTable SET address = "..." WHERE name = "..."
Fill in the ellipses with the corresponding values on each given line of
the text file.

Sometimes I write a Perl script that reads the text file, find the
relevant strings, and outputs a series of SQL UPDATE statements, one for
each line of the text file. Then the result of that can be input as a
script to the familiar mysql CLI.

Sounds like an opportunity for some shareware software developer to
write a wizard-based GUI tool to do this sort of thing!

Regards,
Bill K.
say I have a table w/fields: name | tele_num | age
and I get all the addresses later - address initally
stored in a txt type file with 1 rec /line.
I now want: name | address | tel_num | age
Can I do it this? if not can I do:
name | tele_num | age | address ?

Just need the tools cmds to use and the "flow"
you don't have give the actual SQL unless you want.
Thanks,
Lee G.


Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Gary N. | last post by:
Hi - I'm not sure if I've found a bug with the "splice" function or if I just need better documentation. Splice doesn't work quite how O'Reilly describes it (Javascript, 4th edition, Jan 2002,...
2
by: BrianP | last post by:
Hi, I have had to invent a work-around to get past what looks like a JavaScript bug, the malfunctioning Perl-like JavaScript array functions including SPLICE() and UNSHIFT(). I have boiled it...
2
by: Mark P | last post by:
What should be the output of the following program? The SGI STL docs say that all iterators remain valid during a splice operation. The dinkumware library reference says that iterators to spliced...
6
by: danmcleran | last post by:
Is there a good way to splice two lists together without resorting to a manual loop? Say I had 2 lists: l1 = l2 = And I want a list: as the result.
19
by: Juha Nieminen | last post by:
If I'm not completely mistaken, the only reason why std::list::size() may be (and usually is) a linear-time operation is because they want std::list::splice() to be a constant-time operation, and...
3
by: DeanJo | last post by:
So currently i have an application i developed some time ago that has 2 arrays... FirstName LastName this application randomly goes through the arrays displaying the names as it goes and...
1
by: agendum97 | last post by:
MSDN says splice has the following arguments: arrayObj.splice(start, deleteCount, ]]]) Thus I can insert items into an array using splice. But how do I insert an entire array? For example:...
18
by: dhtml | last post by:
Array.splice({}) What should it do? I think it should return a new Array with length 0. Array.splice(arr, start, deleteCount ]]) http://bclary.com/2004/11/07/#a-15.4.4.12 Example:
1
by: magarwal | last post by:
Hi all, I am a newbie and trying to use splice function to read data from text file. It seems the data doesn't have line breaks but only separated by spaces. All I know is that each row has...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.