I have created a table 'DayPass':
CREATE TABLE DayPass (
memberNo INT PRIMARY KEY, FOREIGN KEY (memberNo) REFERENCES DayPass(memberNo),
startDate Date,
numberDays INT,
price VARCHAR(30),
check(numberDays > 0)
);
I am trying to insert these values:
INSERT INTO DayPass (memberNo, startDate, numberDays, price)
VALUES (3, '2022-01-01', '5', '£9.99');
INSERT INTO DayPass
VALUES (3, '2022-02-01', '5', '£9.99');
INSERT INTO DayPass
VALUES (3, '2022-03-01', '£5', '£9.99');
SELECT * FROM DayPass;
but Postgres gives me an error:
ERROR: duplicate key value violates unique constraint "daypass_pkey"
if am unsure where i am going wrong