Solved

mysql copy entire column to a new one

Posted on 2016-09-23
3
50 Views
Last Modified: 2016-09-23
what is the sql sentence to copy a column to the a new coloumn?
I want to create a copy of a column
0
Comment
Question by:Braveheartli
  • 2
3 Comments
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 41812509
>>what is the sql sentence to copy a column to the a new coloumn?
>>I want to create a copy of a column

ceate a new column first and then use an update query.
0
 
LVL 51

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 41812514
for example:
ALTER TABLE yourTable ADD newCol VARCHAR(250);

Open in new window

then:
Update yourTable Set newCol = oldCol;

Open in new window

0
 
LVL 1

Author Closing Comment

by:Braveheartli
ID: 41812618
thank you
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question