'Insert into tablename Set Example in postgresql
Mysql query:
How to change the query into postgresql?
INSERT into tablename SET a=10, b=20, c=30
Solution 1:[1]
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;
Solution 2:[2]
Insert Query:
INSERT into tablename(a,b,c) values (10,20,30)
Update Query:
update tablename SET a=10, b=20, c=30
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nguyen Van Vinh |
| Solution 2 | Chris Calo |
