Created
April 28, 2014 02:13
-
-
Save kwatch/11360274 to your computer and use it in GitHub Desktop.
[Q] Is it possible to rename column1, column2, ... into arbitrary names in VALUES statement?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- I want to rename column1 and column2 into id and name | |
psql=> values (101, 'Steve'), (102, 'Bill'); | |
column1 | column2 | |
---------+--------- | |
101 | Steve | |
102 | Bill | |
(2 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-- thanks to RhodiumToad!
psql=> select * from (values (101, 'Steve'), (102, 'Bill')) as tmp(id, name);
id | name
-----+-------
101 | Steve
102 | Bill
(2 rows)