March 27, 2021

How to create a table with date column and create records using PostgreSQL?

Sample Query:
CREATE TABLE Claim (
    Account_Number VARCHAR( 25 ) NOT NULL,
    Claim_Amount INTEGER NOT NUll,
    Claim_Id SERIAL PRIMARY KEY,
    Claim_Date Date NOT NULL
);

To Create records:
INSERT INTO Claim ( Account_Number, Claim_Amount, Claim_Date ) VALUES
    ( 'Acc126', 1000, '2019-10-10' ),
    ( 'Acc126', 1300, '2011-02-21'  ),
    ( 'Acc126', 1000, '2012-11-18'  ),
    ( 'Acc126', 2000, '2019-07-15'  ),
    ( 'Acc126', 8000, '2013-08-14'  ),
    ( 'Acc126', 6040, '2016-06-11'  ),
    ( 'Acc127', 1040, '2019-05-09'  ),
    ( 'Acc127', 1000, '2014-04-30'  ),
    ( 'Acc127', 5000, '2015-03-22'  );

No comments:

Post a Comment