0

Me again,

This time I am working on a pg admin sql database and I'm trying to figure out why I am getting this error, I have an insert statement but it keeps saying error: INSERT has more targets than expression, I don't really know why I am getting this error so I don't really know what steps to take to fix this.

INSERT INTO automobiles(id, make, model, year, owner, msrp, purchase_date) VALUES(
1,
'Ferarri'
'F40'
'1987'
''
'1,690,000'
'');

The above is the statement I have inserted.

ERROR:  INSERT has more target columns than expressions
LINE 23: INSERT INTO automobiles(id, make, model, year, owner, msrp, ...
                                           ^
********** Error **********

ERROR: INSERT has more target columns than expressions
SQL state: 42601
Character: 401

This is the error and the error is saying its around model

Also I'm using pg admin

Thanks for the help!

Jessica Simcoe
  • 23
  • 1
  • 1
  • 5

1 Answers1

1

You need to comma separate the values being inserted

INSERT INTO automobiles
(
   id,
   make,
   model,
   year,
   owner,
   msrp,
   purchase_date
)
VALUES
(
   1,
   'Ferarri',
   'F40',
   '1987',
   '',
   '1,690,000',
   ''
);
SE1986
  • 2,534
  • 1
  • 10
  • 29