Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SQL quotation question

 
Werner Fletcher
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

I'm trying to insert this into a table from the MySQL command line: Quote for the day: "bla bla bla"
This is the line I'm using: INSERT INTO table VALUES('Quote for the day: '"bla bla bla"'');

This is not working for me... any help?

Thanks
 
Werner Fletcher
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I accidentally clicked the freaking "Solved" button

What I mean is that I'm not getting the " " around my quote.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35976
422
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't worry about the solved button.

It looks like you have nested single quotes. You need to escape them so the database can see them. In most databases, you write the ' symbol an extra time.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!