update query in mysql with example

MySQL is an open-source relational database management system,actually the name MySQL come from the combinations of words “My“(name of co-founder Michael Widenius’s daughter) and “SQL“(Structured Query Language).Since MySQL is free and open-source it is the most popular and huge used RDBMS. In this section we are going to check out how to write a update query in MySQL.Let me explain the syntax for update query in mysql with example




"UPDATE student  SET mobile ='9999999999' WHERE id='9'";

update query in mysql

php mysql query where description like any of the word in the given string?

Almost all website having a search field on the top it will search in the entire database and display related data in the user interface.so when user type a group of word almost all case user will not get accurate report,because the MySQL query using the LIKE “%$query%/”,so in this tutorial we are planning to elaborate how to search word by word in the database for given string.

#search Form

<form action="search.php" method="post">
<input type="text" name="q" value="">



$searchQ=explode(' ',$q );
foreach($searchQ as $key=>$value)
$searchquery.="description LIKE %".$value."%"
$searchquery.=" OR description LIKE %".$value."%"
$query="SELECT * FROM leads WHERE ".$searchquery;
you can use this query to fetch the data

Mysql query to fetch current month data

Sometimes we need to show only current month data in the application ,so for easy handling the data we should use a Mysql query to fetch current month data.Let we check out how to do that using one MySQL query

See below the Mysql query to fetch current month data

FROM leads
// leads= Table Name
// date = date field name

Here we are fetching current month data using the feature MONTH(CURRENT_DATE()) and MONTH(date)

MONTH(CURRENT_DATE()) will result 8 (since current month is Aug)

Next feature we are using in Mysql query to fetch current month data is YEAR(date) and YEAR(CURRENT_DATE())

YEAR(CURRENT_DATE()) will result 2019 (since today is Aug 24 2019)

so actual Mysql query to fetch current month data will work like this

FROM leads
WHERE MONTH(date) = 9
AND YEAR(date) = 2019

so it will fetch all result form database table leads that having date field value is in august month

how to insert Hindi language in MySQL,now ???? is coming in DB

We have to add different languages like Hindi,Marathi, Tamil etc inside text filed as per the required. Normally if you insert Hindi it will come ?????????? instead of characters in DB.To avoid this situation we have to set the DB to utf8 COLLATE utf8_unicode_ci.It support other character set also.Here am going to explain how to set it ,to insert Hindi language in MySQL we have to do below action