Question: In the pictures below the table with 2 rows is the source table and the one with one row is the target table. i basically

In the pictures below the table with 2 rows is the source table and the one with one row is the target table. i basically want the data in the source table transfered into the target table in a way that makes the target table look like the picture i provided. imagine I have a a source table worh 3 columns. those columns are as follows: name, city, food. now i have two rows with the same name and city but food is different. for example: the same person from the same city made two orders. so now i want to migrate that data into a target table where there are 4 columns, those being: name, city, food_one, food_two. I want a query that will transfer data from the source table to the target table. i want this query to to be set up a way that the two food values in the sourcetable are put into food_one and food_two coulmns in the target table.
 In the pictures below the table with 2 rows is the
source table and the one with one row is the target table.
I am looking for a SQL query

\begin{tabular}{|l|l|l|} \hline Name & City & Food \\ \hline James & Atlanta & Cake \\ James & Atlanta & Ice-cream \\ \hline \end{tabular} \begin{tabular}{|l|l|l|l|} \hline Name & City & Food_one & Food_two \\ \hline James & Atlanta & Cake & Ice-cream \\ \hline \end{tabular}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!