HumbleApprentice Posted April 26, 2012 Share Posted April 26, 2012 Hi can someone please tell me why I am getting an error message with this ALTER STATEMENT. I entered the wrong isbn number in my table and would like to change it. The version of mySQL that I am using is 5.5.20-log. Thanks. ALTER TABLE classics WHERE title ='Little Dorrit' CHANGE isbn = '9780141439969'; Link to comment Share on other sites More sharing options...
niche Posted April 26, 2012 Share Posted April 26, 2012 Looks like you're changing the contents of the table not the table. Try UPDATE. http://www.w3schools.com/sql/sql_update.asp 1 Link to comment Share on other sites More sharing options...
justsomeguy Posted April 26, 2012 Share Posted April 26, 2012 To help clarify, ALTER TABLE changes the structure of the table, UPDATE changes the data in the table. 1 Link to comment Share on other sites More sharing options...
HumbleApprentice Posted April 30, 2012 Author Share Posted April 30, 2012 Hi Guys, I tried UPDATE but it does not work. Here is the error message: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE classics WHERE title ='Little Dorrit' CHANGE isbn = '9780141439969'' at line 1 I get the same message when I use ALTER Link to comment Share on other sites More sharing options...
justsomeguy Posted April 30, 2012 Share Posted April 30, 2012 You don't use the words "table" or "change" in an update query, check some of the examples in the link above. Link to comment Share on other sites More sharing options...
HumbleApprentice Posted April 30, 2012 Author Share Posted April 30, 2012 Thanks Guys, Problem solved. The UPDATE STATEMENT fixed it. Here is the code: UPDATE classics SETisbn = '9780141439969'WHERE title = 'Little Dorrit' ; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now