Skip to content
Advertisement

Insert new records with several ids from another table

I have a table, which has 9 records with id = 1 – 9 (for example, there can be more than 20 ids).

I have one varchar value = ‘premium’.

I need to insert these values to another table, after this action I should have 9 records with id from the first table and ‘premium’ varchar in the second table:

How to write the function for SQL?

Advertisement

Answer

Are you looking for insert . . . select or create table as?

or:

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