atulpratik
atulpratik

Reputation: 1

ERROR: INSERT has more target columns than expressions, this is the error which I'm getting in PostgreSQL

INSERT INTO customer_data
  (cus_id, cust_name, age, city, salary)
VALUES
  (1, 'Sam', 'Delhi',9000),
  (2, 'ROhit', 'Banglore', 5000),
  (3, 'Rahul', 'Mumbai', 12000),
  (4, 'Sunny', 'Odisha',15000);

This is my Code

Upvotes: 0

Views: 53

Answers (2)

tesfahun
tesfahun

Reputation: 13

the values part is missing the age value

Upvotes: 0

Abhishek Nimje
Abhishek Nimje

Reputation: 38

Your SQL query should contain same number of columns as same number of values you column count in this

INSERT INTO customer_data (**cus_id**, **cust_name**, **age**, **city**, **salary**) 

part of query is 5 whereas value count is 4 in this part

VALUES (**1**, **'Sam'**, **'Delhi'**,**9000**) ...

Upvotes: 1

Related Questions