For instance:
{create table Participant ( id serial, primary key(id) );}
How do you insert into table in this case?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you create the table like above,
You can use
defaultin following way to insert:Check out SQLFIDDLE.
Another way to insert is:
CREATE TABLEwill create implicit sequence"Participant_id_seq"for serial column “Participant.id".You can get the sequence for the table using
pg_get_serial_sequencefunction in following way:It will take new value from sequence using
NEXTVAL().Check out SQLFIDDLE