Search
MySQL in a Nutshell
If you work with MySQL regularly and find my writing style and examples helpful, please consider buying my book, MySQL in a Nutshell . The second edition just came out: I'm very proud of it and am starting to get great reviews about it. Click on the cover art work here and you'll be taken to Amazon's site where you can purchase a copy and have it mailed to you.
MySQL Tips
Below is a quick tips related to the topic of this page. It has been randomly selected from a database containing several. Refresh this page to see another.
Inserting Near the End
If you need to insert some text to the tail end of a column's data, but not the exact end, you can accomplish this with the function TRIM(). For example, suppose you have a column that contains HTML text that ends with a paragraph tag (i.e., </p>) and you want to add text to the end of the column, but before the </p>. Here's one way you could do that easily:
UPDATE table1 SET col1 = CONCAT(TRIM(TRAILING '</p>' FROM col1), 'END_OF_COMMENT', '</p>') FROM table1;
In this SQL statement, the TRIM() function is used to remove the trailing HTML paragraph tag, to remove the tag from the end of the column. The results from that function is the full column data without the ending. The CONCAT() function is employed to paste together the results of the TRIM() function with the text we want to add (i.e., END_OF_COMMENT), followed by the paragraph tag again.

MySQL Resources
This is a new section of my web site that I'm putting together. On my site I have many resources related to MySQL database software. But, they're a bit scattered. I have articles that I've written on MySQL in one section. In another section I have my own documentation of MySQL with good examples of how to use SQL statements and functions. To pull these resources together in a central starting point, I'm setting up this web page and section. So, please bear with me as it comes together. Also, please let me know if you have ideas of resources that I can add to improve this section.
MySQL Documentation
If you click on the title here, you'll find my own documentation of MySQL that I'm developing. If you know on which SQL statement or function you want information and you want to get right to it, go to my Alphabetical List or just use the article search box in the left margin.
MySQL Tutorials
If you're a beginner or still new to some aspects of MySQL, below are links to some of tutorials that I've written and published. It's a set of articles for common tasks. If you don't see what you want in this list, the check out my Other MySQL Articles or just use the article search box in the left margin.