Questions tagged [postgresql-serial]

3 questions
63
votes
5 answers

How to insert a record into a table with a column declared with the SERIAL function

My database is using PostgreSQL. One table is using the serial auto-increment macro. If I want to insert a record into the table, do I still need to specify that value, or it is be automatically assigned for me? CREATE TABLE dataset ( id serial…
AntiGMO
  • 1,535
  • 5
  • 23
  • 38
12
votes
3 answers

Insert statement asked me to insert for autoincrement column

I use PostgreSQL. I have created the following table: CREATE TABLE "Task" ( "taskID" serial NOT NULL, "taskType" text NOT NULL, "taskComment" text NOT NULL, "taskDate" date NOT NULL, CONSTRAINT "Task_pkey" PRIMARY KEY ("taskID") ) I put…
Aan
  • 12,247
  • 36
  • 89
  • 150
6
votes
2 answers

What is difference between BIGSERIAL and SERIAL?

I'm new on PostgreSQL for auto-increment we have to use BigSerial or Serial, so can anyone please explain which one we have to use when creating a table. Which one be the best please explain scenario wise.