Valeur de mise à jour postgresql Auto_increment
ALTER SEQUENCE product_id_seq RESTART WITH 1453
Cybernated Dev
ALTER SEQUENCE product_id_seq RESTART WITH 1453
-- SERIAL keyword auto increments the value
CREATE TABLE Colleges (
college_id INT SERIAL,
college_code VARCHAR(20) NOT NULL,
college_name VARCHAR(50),
CONSTRAINT CollegePK PRIMARY KEY (college_id)
);
-- inserting record without college_id
INSERT INTO Colleges(college_code, college_name)
VALUES ("ARD13", "Star Public School");
ALTER TABLE temp ALTER COLUMN id
ADD GENERATED BY DEFAULT AS IDENTITY
CREATE SEQUENCE cateogry_id_seq;
ALTER TABLE category ALTER COLUMN category_id SET DEFAULT nextval('cateogry_id_seq');
SELECT setval('test_id_seq', (SELECT MAX(id) from "test"));