Skip to content
Advertisement

insert same record multiple times based on the given count

I want to insert ABC thrice, EDC four times, FDC twice in a table using single SQL, is it possible? The output of the query should insert into the following table with the following entries.

Thanks

Advertisement

Answer

You would typically use a recursive query:

Here is a demo; the syntax works in both Postgres and MySQL 8.0.

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