I need to insert dataset in postgresql.
INSERT INTO table_subject_topics_exams (name_of_subject, section, topic, subtopic)
VALUES ('Algebra', 'Mathematics', 'Progressions', 'Number Sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Arithmetic Progression'),
('Algebra', 'Mathematics', 'Progressions', 'Arithmetic Progression'),
('Algebra', 'Mathematics', 'Progressions', 'Arithmetic Progression'),
('Algebra', 'Mathematics', 'Progressions', 'Arithmetic Progression'),
('Algebra', 'Mathematics', 'Progressions', 'Geometric Progression'),
('Algebra', 'Mathematics', 'Progressions', 'Geometric Progression'),
('Algebra', 'Mathematics', 'Progressions', 'Geometric Progression'),
('Algebra', 'Mathematics', 'Progressions', 'Geometric Progression');
the problem is that there are many duplicate values in the request. As the result database should involve
('Algebra', 'Mathematics', 'Progressions', 'Number sequences'),
('Algebra', 'Mathematics', 'Progressions', 'Arithmetic Progression'),
('Algebra', 'Mathematics', 'Progressions', 'Geometric Progression');
Or nothing if this dataset is in database. How should I make my query?
P.S.
The table is:
CREATE TABLE public.table_subject_topics_exams
(
ids_of_subject_section integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
name_of_subject character varying(50) COLLATE pg_catalog."default" NOT NULL,
section character varying(50) COLLATE pg_catalog."default",
topic character varying(50) COLLATE pg_catalog."default" NOT NULL,
subtopic character varying(50) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT table_subject_topics_exams_pkey PRIMARY KEY (ids_of_subject_section)
)
question from:
https://stackoverflow.com/questions/65642402/insert-data-into-postgresql-with-duplicate-values