nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Question - Syntax on "CHANGE"

This is a discussion on Question - Syntax on "CHANGE" within the Databases servers forums, part of the Mastering Servers category; Hi folks, Ran following command to create aliases table Code: mysql> CREATE TABLE `aliases` ( -> `pkid` smallint(3) NOT NULL ...


Go Back   nixCraft Linux Forum > Mastering Servers > Databases servers

Linux answers from nixCraft.


Databases servers Discussions of databases of all types - especially MySQL.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 22-05-2009, 07:22 AM
Senior Member
User
 
Join Date: Sep 2007
OS: Debian
Posts: 112
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 3
satimis is on a distinguished road
Default Question - Syntax on "CHANGE"

Hi folks,


Ran following command to create aliases table
Code:
mysql> CREATE TABLE `aliases` (
    -> `pkid` smallint(3) NOT NULL auto_increment,
    -> `mail` varchar(120) NOT NULL default '',
    -> `destination` varchar(120) NOT NULL default '', 
    -> `enabled` tinyint(1) NOT NULL default '1',
    -> PRIMARY KEY (`pkid`),
    -> UNIQUE KEY `mail` (`mail`)
    -> ) ;
Query OK, 0 rows affected (0.01 sec)
And ran following command to enter data
Code:
mysql> INSERT INTO aliases (mail,destination) VALUES
    -> ('albert@abc.com','albert@abc.com'),
Now I need to change "albert@abc.com" to "albertlee@abc.com" running following command without sucess
Code:
mysql> ALTER aliases CHANGE 'albert@abc.com', 'albertcheung@abc.com' varchar(120) ;

mysql> ALTER aliases CHANGE 'albert@abc.com' 'albertcheung@abc.com' ;

mysql> ALTER aliases CHANGE 'albert@abc.com', 'albertcheung@abc.com' ; 
etc.
Always syntax error.


Please advise what will be the correct syntax? TIA

Will MODIDY be the same as CHANGE?

Can I use DROP to erase this email address? If YES please advise how?


B.R.
satimis
Reply With Quote
  #2 (permalink)  
Old 22-05-2009, 11:41 AM
kasimani's Avatar
Senior Member
User
 
Join Date: Jul 2006
Location: India, Delhi
OS: CentOS, RedHat, Fedora, Ubuntu
Posts: 151
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 4
kasimani is on a distinguished road
Send a message via Yahoo to kasimani
Default

use this method

Code:
 UPDATE aliases SET 'mail' = 'albertcheung@abc.com' WHERE 'aliases'.'pkid' =1;

Last edited by nixcraft; 23-05-2009 at 04:27 PM.
Reply With Quote
  #3 (permalink)  
Old 22-05-2009, 12:01 PM
Senior Member
User
 
Join Date: Sep 2007
OS: Debian
Posts: 112
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 3
satimis is on a distinguished road
Default

Quote:
Originally Posted by kasimani View Post
use this method

UPDATE aliases SET 'mail' = 'albertcheung@abc.com' WHERE 'aliases'.'pkid' =1;
Hi kasimani,


Thanks for your advice.

What is
Code:
'aliases'.'pkid' =1
?

Please explain in detail. Thanks


B.R.
satimis
Reply With Quote
  #4 (permalink)  
Old 23-05-2009, 04:26 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

You are matching field with where option. Please read SQL statement or syntax below:
MySQL :: MySQL 5.0 Reference Manual :: 12.2.11 UPDATE Syntax
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
How to check "incorrect mails" before sending it through my mail server? nishith Mail Servers 1 28-04-2009 01:41 AM
Redhat: Up2date " permission denied" while root guarrand Getting started tutorials 2 03-07-2008 11:50 AM
Does Redhat have "what" utility which can be used to display identification Info? DCAO Linux software 2 30-10-2007 07:23 PM
[Commercial] SafeSquid "SPEED-BOOSTER" 4.2.0 Released httpproxy Networking, Firewalls and Security 1 26-09-2007 08:05 PM
iptables with "! --syn" question kkruecke Linux software 3 31-10-2006 07:34 PM


All times are GMT +5.5. The time now is 12:57 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38