Solved

mysql copy entire column to a new one

Posted on 2016-09-23
3
40 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 49

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 49

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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now