1
ernestfran
SQL Entry Update
  • 2011/7/31 21:09

  • ernestfran

  • Just popping in

  • Posts: 2

  • Since: 2011/7/31


Hi all, I'm new to the forums.
I'm trying to update an entry in my database via command through a shell prompt but it doesn't seem to be working.

I want to update a column called name with a new name which is in a table called users in database db_db1

How would I go about doing this with the UPDATE, SET, WHERE command in one line?

Anyone know??

2
zyspec
Re: SQL Entry Update
  • 2011/8/1 15:14

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


You would use something like:
ALTER TABLE users CHANGE name new_name VARCHAR 128;


But you should note that the 'new' column may not have all the attributes that the old column does (NOT NULL, etc) unless you explicitly define them too. Indexes may also need to be modified if they're set for this column/table.

You can find more info at http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

Login

Who's Online

445 user(s) are online (355 user(s) are browsing Support Forums)


Members: 0


Guests: 445


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits