Skip to content

TABLE

Return the same results as a select * query against a table.

TABLE table_name [ * ]

You can use WITH, UNION, INTERSECT, EXCEPT, ORDER BY, LIMIT, and OFFSET in conjunction with the TABLE command, just as you would with a SELECT query.

For example:

premdb=# TABLE hometeam;
 htid |          name           
------+-------------------------
   2 | Arsenal
   3 | Aston Villa
   4 | Barnsley
   5 | Birmingham City
   6 | Blackburn Rovers
...
premdb=# TABLE hometeam UNION TABLE awayteam ORDER BY 1 DESC;
 htid |          name           
------+-------------------------
  100 | 
   99 | 
   98 | 
   97 | Wolverhampton Wanderers
   96 | Wimbledon
...