Skip to content
Advertisement

Get Data from a single table to an empty table

I am quite new to SQL. I couldn’t find solution and I want your expertise here.

I have one table “boxes” and contains the color and type and condition. I want to get the number of types per color WHERE Condition = ‘NEW’. Thanks in advance 🙂

My tale looks like that:

I want to put the data from here into another table called “ColorPerType”

expected output:

Advertisement

Answer

You need a SELECT...INTO statement if ColorPerType does not exist:

See the demo.
If the table ColorPerType already exists use this:

See the demo.

Results:
ColorPerType table

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement