Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert into tablename Set Example in postgresql

Tags:

postgresql

Mysql query:

How to change the query into postgresql?

INSERT into tablename SET a=10, b=20, c=30
like image 243
selva Avatar asked Oct 29 '25 08:10

selva


1 Answers

PostgreSQL does not support syntax INSERT...SET (mysql does).

But another systax can be something you need:

with full fields:

INSERT into tablename
       SELECT 10 AS a, 20 AS b, 30 as c;

with specific fields:

INSERT into tablename (b, c)
       SELECT 20 AS b, 30 as c;