Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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.
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions