Inserting values into a table not working [duplicate] - postgresql

This question already has answers here:
INSERT COMMAND :: ERROR: column "value" does not exist
(2 answers)
Error "value" does not exist - postgresql INSERT INTO issue
(1 answer)
Why does Postgres say column does not exist? [duplicate]
(1 answer)
PostgreSQL - insert statement error, thinks value to insert is a column name
(1 answer)
Closed 3 years ago.
I am trying to insert a value(row) into my table users but it's giving error that column doesn't exist.
User table:
users
insert into users (id,name,gender,city,age,company)
values (1,omkar,"male","cuttack",24,"tcs");
I am getting column does not exists. And with some specific values I am getting hint don't know why.
Error screenshot

You must use single quotes for literal string values. Double quoting is interpreted as being an identifier, in this case a column name, which causes the error.
insert into users (id,name,gender,city,age,company)
values (1,'omkar','male','cuttack',24,'tcs');

If you set "Id" is auto increase, you can try bellow
insert into users (name,gender,city,age,company) values ('omkar','male','cuttack',24,'tcs');

Related

Postgresql column not exists when trying to insert [duplicate]

This question already has answers here:
INSERT COMMAND :: ERROR: column "value" does not exist
(2 answers)
cannot get simple PostgreSQL insert to work
(4 answers)
Closed 9 months ago.
DROP TABLE IF EXISTS workspace;
CREATE TABLE "workspace" (
"wk_space" VARCHAR(100) NOT NULL,
"token" TEXT,
PRIMARY KEY("wk_space", "token")
);
INSERT INTO "workspace" ("wk_space", "token") VALUES ("team1", "upreawnysoafa22sva") ON CONFLICT (wk_space, token) DO NOTHING;
SELECT * FROM workspace;
This will give an error saying column "team1" does not exist. If I replace the values ("team1", "upreawnysoafa22sva") to numbers like (11, 22), it works fine. I don't know what's going wrong.

One query runs fine but a very similar one does not run at all [duplicate]

This question already has answers here:
PostgreSQL "Column does not exist" but it actually does
(6 answers)
sql statement error: "column .. does not exist"
(1 answer)
Closed 1 year ago.
I have been using SQL for many years, but I am pretty new to postgresql. I'm using pgAdmin and I'm running the following query just fine.
select *
from budget_spending
where market is not null
limit 10
However, this query does NOT run.
select *
from budget_spending
where Project_Description is not null
limit 10
I get this error message:
ERROR: column "project_description" does not exist
This is very bizarre, because I'm looking at it and it certainly does exist. If I right-click the column and go to Properties, I see 'Project_Description' as the name of the column. What am I missing here?

Getting an error on a Postgres table "ERROR: column does not exist" that doesn't make sense to me [duplicate]

This question already has answers here:
PostgreSQL "Column does not exist" but it actually does
(6 answers)
sql statement error: "column .. does not exist"
(1 answer)
PostgreSQL column 'foo' does not exist
(12 answers)
SQL query column does not exist error
(1 answer)
Closed 1 year ago.
In pgAdmin if I do a simple select:
"select * from NFT where item_id = 1271" I get what I would expect:
However, when I try to query on this other column: "select * from NFT where tokenID = 40" I get an error: "ERROR: column "tokenid" does not exist
I'm new to Postgres in the last year, have used it quite a bit but this one has me stuck on how to proceed. It's just a normal column.
any ideas?

What is the exact way of using where clause in PostgreSQL 12? [duplicate]

This question already has answers here:
PostgreSQL "Column does not exist" but it actually does
(6 answers)
sql statement error: "column .. does not exist"
(1 answer)
Postgres column does not exist
(1 answer)
Closed 1 year ago.
I am trying to query a table using where clause in Postgres 12
case 1
SELECT *
FROM schema.e_employee_table
WHERE FK_EMPLOYEE=100;
so when i query the above query i get "FK_EMPLOYEE" column is missing.
case2:
SELECT *
FROM schema.e_employee_table
WHERE "FK_EMPLOYEE"=100;
when i query the above one i got the query results
So can someone explain do we need to put our column name inside "",is it the syntax. If so where it is mentioned in the official documentation.
And I can also see the column name we are mentioning is case sensitive.

How can I query in psql. If column name like camelCase [duplicate]

This question already has answers here:
Are PostgreSQL column names case-sensitive?
(5 answers)
Closed 5 years ago.
My psql table structure like below:
id userName gender
1 xxxx Male
if I am using query like below from psql shell:
select * from table where userName="xxx";
It gives error:
Error: column "userName" does not exists.
How can I query if column name contain with camelCase.
All identifiers are converted to lower case in postgres. To use upper case identifiers you should use double quotes around identifier to say postgres to not convert it to lower case :
select * from table where "userName" = 'xxx';