I have a
with meterid,meterreading,reader and date read.I wish to store this data using Postgis database. I used this code via postgresql to create the table CREATE TABLE MeterRdg(meterid VARCHAR(5) NOT NULL PRIMARY KEY, reading integer,reader VARCHAR(15),DateRead date).
I then tried to insert data into the table using the following command
INSERT INTO MeterRdg(meterid, reading,reader,DateRead) VALUES ('M1',871.31,'Kamau','26/02/2015'), ('M2',624.53,'Kamau','26/02/2015'), ('M3',531.47,'Kamau','27/02/2015'), ('M1',926.44,'Ochieng','25/03/2015'), ('M2',761.31,'Ochieng','26/03/2015'), ('M3',683.51,'Ochieng','26/03/2015')
I get
that the primary ERROR: duplicate key value violates unique constraint "meterrdg_pkey" DETAIL: Key (meterid)=(M1) already exists.
How can I redesign the CREATE table command such that M1,M2,M3 can hold multi-values
أكثر...
with meterid,meterreading,reader and date read.I wish to store this data using Postgis database. I used this code via postgresql to create the table CREATE TABLE MeterRdg(meterid VARCHAR(5) NOT NULL PRIMARY KEY, reading integer,reader VARCHAR(15),DateRead date).I then tried to insert data into the table using the following command
INSERT INTO MeterRdg(meterid, reading,reader,DateRead) VALUES ('M1',871.31,'Kamau','26/02/2015'), ('M2',624.53,'Kamau','26/02/2015'), ('M3',531.47,'Kamau','27/02/2015'), ('M1',926.44,'Ochieng','25/03/2015'), ('M2',761.31,'Ochieng','26/03/2015'), ('M3',683.51,'Ochieng','26/03/2015')
I get
that the primary ERROR: duplicate key value violates unique constraint "meterrdg_pkey" DETAIL: Key (meterid)=(M1) already exists.How can I redesign the CREATE table command such that M1,M2,M3 can hold multi-values
أكثر...