MySQL Queries Cheat Sheet

Home > Programming & Technology

The most common MySQL queries are listed in this document. These are the queries that I use mostly and they are my reference when I am writing queries. These are all the queries that you need to know for your MySQL database applications.

Append a Value in a String Column

UPDATE quotes SET tags = CONCAT(col_name,' and append this') WHERE category = 1;

 

If Column is Null

If the field code is NULL by default you need to use:

 

UPDATE table_name SET col = CONCAT(IFNULL(col_name,''), 'and append this') WHERE id = 1;

 

Otherwise the concat will always result in NULL. 

 

Replace a String in a string field

 

UPDATE table_name

SET col = REPLACE(col, 'match', 'replace')

 

For Example,

 

UPDATE articles SET tags = REPLACE(tags, "Top", 'Top 10')

 

This query only replaces the text that matches, so if the string and more than the matched text, the rest of the unmatched text remains intact and is not lost.

Comment Form is loading comments...

Table of contents









Most common .htaccess rules

In this article, i have listed the most common htaccess uses that we encounter and it will serve you as a quick cheatsheet whenever you realize you need to touch your precious .htaccess file and are clueless of what kind of rule need to be written in the file to achieve what you want.

How does Siri suggest contacts

Is Siri suggesting you to call your ex-boyfriend, ex-husband or your crush?How does Siri suggests contacts to Call or Whatsapp?Siri has access to your Whatsapp data, which includes your Data and Storage Usage. Siri is very likely using this data to understand your texting pattern.

[Solved] You do not have permission to save in this location - MacOs

Before you read the solution to this error, if you are using QuickTime Player to export a file and this issue is coming, just keep the video window open and you won't get this error.





6 Simple steps to Install SSL Certificate

Regardless of the kind of server you use (Apache HTTP Server, Tomcat or IIS), this simple guide to SSL Certificate installation will give you the overall idea of how the SSL Certificate is issued and installed and will help you in understanding the steps and troubleshoot the problems that you may be

MySQL Queries Cheat Sheet

The most common MySQL queries are listed in this document. These are the queries that I use mostly and they are my reference when I am writing queries. These are all the queries that you need to know for your MySQL database applications.