INSERT … ON DUPLICATE KEY UPDATE

If you mention ON DUPLICATE KEY UPDATE when a row is inserted that is causing a duplicate value in a UNIQUE index or PRIMARY KEY then MySQL performs an UPDATE of the old row. Suppose, […]
If you mention ON DUPLICATE KEY UPDATE when a row is inserted that is causing a duplicate value in a UNIQUE index or PRIMARY KEY then MySQL performs an UPDATE of the old row. Suppose, […]
In MySQL, you can update fields of one table from another table with a conditional statement also. For example, you have two tables i.e. “user_activity” and “user”. And you need to update a column in […]
In MySql, GROUP_CONCAT() is used to convert multiple rows into a single string. However, the maximum length of the result of this function is 1024 characters. So, You should first check the character length that […]
Trying to select data from a MySQL table, but getting the error messages: mysql_fetch_array() expects parameter 1 to be resource, boolean given? – This may happen for various reasons like both the mysql_* and the […]
In MySQL, while searching column using MATCH AGAINST keywords then the result matches all the row with search character more than 3. If you see the system variable ft_min_word_len, which specifies the minimum length of […]
Sometimes we may face about performance issues while opening a website. Not only databases but we need to optimize our programming code also. MySQL Best Practices means few tips to optimize the MySQL query: Avoid […]
MySQL has an alternative of IF statement i.e. MySQL CASE statement by which you can check conditional statement. Besides the IF statement in MySQL, this provides an alternative conditional statement i.e. called CASE. The MySQL […]
There are so many MySQL functions that commonly used to minimize the statements like string operation functions, date time functions, aggregate functions etc. MySQL LAST_INSERT_ID To get the last generated sequence number of the last […]
If statement allows you to execute a set of SQL statements based on condition. If certain condition returns true then statement executes, otherwise not. Example: DELIMITER $$ CREATE PROCEDURE MyifCond() BEGIN DECLARE x INT; SET […]
Cursor allows you to iterate a group of rows fetched by a query and process each row. It is read only, non-scrollable and asensitive. Declare a cursor: DECLARE <cursor_title> CURSOR FOR SELECT_statement; Open a cursor: […]