CREATE TABLE master_techsheet_headers_backup (LIKE master_techsheet_headers INCLUDING ALL); assign new sequnce for copied table -- Step 1: Create new sequence CREATE SEQUENCE master_techsheet_header_backup_id_seq START WITH 1 INCREMENT BY 1; -- Step 2: Attach it to the id column ALTER TABLE master_techsheet_header_backup ALTER COLUMN id SET DEFAULT nextval('master_techsheet_header_backup_id_seq'); -- Step 3: Restart if needed ALTER SEQUENCE master_techsheet_header_backup_id_seq RESTART WITH 1;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter