Files | How Can I Output MySQL Query Results In CSV Format?

In this post, we will discuss How can I output MySQL query results in CSV files format which we can do using select into outfile statement before giving the name of the file along with the extension. Files Extraction in CSV Format We can get a csv format of the data stored in a database … Read more

Laravel | How to use multiple databases in Laravel?

In this post, we will discuss How to use multiple databases in Laravel which we can perform using separate database connections for each database in the config/ database.php file for the same we have given an example of code to understand it better. Laravel We have given an example here to understand it in better … Read more

How to Delete All Duplicate Rows Except For One In MySQL?

In this post will learn How to Delete all Duplicate Rows except for One in MySQL which we can perform using the combinations of different statements like group by, Min, and Max functions, Where group by the function will help in grouping the duplicate values or the rows which is completely based on the specified … Read more

How to fill missing dates in range MySQL?

In this post, we will discuss How to fill in missing dates in range MySQL for which we need to combine a subquery and union statement where we use the subquery to generate the list of all the lists of required ranges as we want and the union statement for combining the exported list with … Read more

Write SQL Query Return Data From Multiple tables.

In this post, we will explore some SQL query return data from multiple tables which we can perform using join in Mysql, and based on the common columns we can retrieve the data from multiple tables, So for the same we have taken an example below and performed the desired operation. Return Data From Multiple … Read more

Difference Between INSERT IGNORE” vs “INSERT ON DUPLICATE KEY UPDATE”

In this post, we will learn the difference betweenĀ  INSERT IGNORE” vs “INSERT ON DUPLICATE KEY UPDATE” where both of them are used for inserting the data in a table with a slit difference that is in case of insert ignore we ignore the record which violates the rule or contain the table, for example, … Read more

Union How to SQL split values to multiple rows?

In this post, we will learn how to SQL split values to multiple rows which we can perform using the union operator and the select statement of MySQL. For the same, we have given an example below. Use Of UnionĀ  As we know in SQL, you can split value in a column into multiple rows … Read more

How can I do ‘insert if not exists’ in MySQL and update if exist?

In this post, we will learn How can I do ‘insert if not exists in MySQL and update if exist where for data or record to add new if it does not exist we can perform using insert into, Whereas we can make changes in existing data or we can update the existing data by … Read more

How to do a regular expression replace in MySQL?

In this post, we will learn How to do a regular expression replacement in MySQL Where regexp replaces () is used to replace a pattern in a string with another string using a regular expression which we will see as an example here. Regular Expression Replacement For replacing a pattern in a string with another … Read more

How Can I SELECT Rows with MAX( Column value), PARTITION by Another Column in MYSQL?

In this post, we will learn How can I SELECT rows with MAX (Column value), and PARTITION by another column in MYSQL which we can perform using the row number function to select the rows that have the highest values in a column and in addition to that it has a division too and that … Read more

%d bloggers like this: