Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTony K
Courses Plus Student 442 PointsCannot Update row in MySQL !
UPDATE film SET rating=8 WHERE name="Memento";
My First value in the "rating" field was "NULL". BUT... WHEN I EXECUTE THE ABOVE STATEMENT IT SHOWS ,
"0 row(s) affected Rows matched: 0 Changed: 0 Warnings: 0"
PLZ HELP ME !!
4 Answers
Steven Parker
231,261 PointsIf the ANSI_QUOTES SQL mode is enabled, string literals can be quoted only within single quotation marks because a string quoted within double quotation marks is interpreted as an identifier.
Try changing your query to:
UPDATE film SET rating = 8 WHERE name = 'Memento';
Andrew Patterson
3,075 PointsHey Tony, I think I might be able to help. Is it possible for you to give me a little more information about this database? The first thing I would check is that the table name is "film". Usually the name is pluralized like "films". Could this be the problem?
Tony K
Courses Plus Student 442 PointsMY DATABASE INFO :
Database name : movie_db Table Name : film Columns Names : name , rating
Andrew Patterson
3,075 PointsIt seems like the syntax is correct. Are you doing this with the mySQL workbench or in the console? I would check that "Memento" is really the correct name of the film because the error is saying that it didn't make any matches with the WHERE statement you provided.
Tony K
Courses Plus Student 442 PointsI'am Using My SQL Workbench and the name is correct i checked it twice !!
Andrew Patterson
3,075 PointsAlrighty so it sounds like when you added Memento to the database it might not have saved properly. That could be the reason it's not able to find it. Can you show me the verification that it saved? Or was Memento already part of the seeded database? Which exercise is this for?