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

How Can we concatenate multiple MySQL Rows Into One Field?

In this post, we will learn How Can we concatenate multiple MySQL rows into one field, which we can perform using a built in function group concat, which is used for merging two or more rows into a single field. For the same, we have given an example with a pseudo code which could help … Read more

MySQL – Rows to Columns Conversion

In this post, we will learn how to convert Rows to columns and columns into row which we can do using transpose where each row is restored as a column for the same we have given an example where we have transposed the table. Rows To Column Conversion Let’s take an example of the given … Read more

Using LIMIT within GROUP BY to get N results per group?

In this Post, Using LIMIT within GROUP BY to get N results per group whereas in MySQL limit is used for filtering or restricting the data to display where we can limit the data as per our choice where we can restrict the number of rows given by a query more over we can use … Read more

How to Retrieve The Last Record in Each Group – MySQL

In this post, we will learn about Retrieve the last record in each group in MySQL which we can perform using the group by clause and max function The basic idea is to group the records by a certain attribute and then find the maximum values which could be from the primary key( where we … Read more

%d bloggers like this: