Variable declaration in postgres

Viewed 27

How to create variable with two word separated by space in Postgresql.

CREATE TABLE Test(
    Partner varchar(10) NULL,
    "[Partner Name]" varchar (200) NULL,
    "[Contract Number]" varchar(15) NULL,
    "[Customer Name]" varchar(150) NULL,
    "[Lease Start]" Date date NULL
From maintable

This is not working. How to give variables with 2 words separated by space. Please help

1 Answers

Seems you want to populate the data in new table named test from other table named maintable with column names having spaces.

below is the syntax

CREATE TABLE Test 
as select col1 as  Partner ,
col2 as "Partner Name", 
col3 as "Contract Number", 
col4 as "Customer Name",
col5 as "Lease Start Date" from maintable;
Related