我正在 Postgres 中创建两个表。
第一个表有一个主列和其他列,并且在第二个表中有一个主列“MLeaseId”,这些列在第一个表中相同(不是第一个表的主列)和其他列。
如何将数据从第一个表列复制到第二列数据?
CREATE TABLE leasetype (
"LeaseTypeId" integer NOT NULL ,
"MLeaseId" character varying(45) NOT NULL,
"Resident" integer NOT NULL,
"Business" integer NOT NULL,
"RArea" float NULL,
"BArea" float NULL,
"RRent" double NULL,
"BRent" double NULL,
PRIMARY KEY (LeaseTypeId)
);
CREATE TABLE masterlease (
"SrNo" integer unsigned NOT NULL,
"MLeaseId" varchar(45) NOT NULL,
"ExtId" integer unsigned NOT NULL,
"MPlotNo" character varying(45) NOT NULL,
"DPlotNo" character varying(45) NOT NULL,
"SheetNo" character varying(45) NOT NULL,
"NastiNo" character varying(45) NOT NULL,
"Date" date NOT NULL,
"LHolderName" character varying(45) NOT NULL,
"PhoneNo" character varying(45) DEFAULT NULL,
"TotArea" double NOT NULL,
"LeaseDuration" float NOT NULL,
"UseTypeId" int(6) NOT NULL,
"LFromDate" date NOT NULL,
"LToDate" date NOT NULL,
"OrderDtl" text,
"Remark" text,
"Address" character varying(300) NOT NULL,
PRIMARY KEY (MLeaseId)
)