Can't select column with bigint from a specific table [duplicate] - sql

This question already has answers here:
PostgreSQL "Column does not exist" but it actually does
(6 answers)
Postgresql Column Not Found, But Shows in Describe
(1 answer)
SQL query column does not exist error
(1 answer)
Closed 12 months ago.
im currently working on a table in postgres where I want to select some columns and copy those into another table. But when I'm trying to do a select statement on the column I got the following error:
ERROR: column "opentime" does not exist
LINE 2: select openTime from dialy;
^
HINT: Perhaps you meant to reference the column "dialy.openTime".
SQL state: 42703
Character: 9
This happens on every column where the datatype is bigint. the other columns in the table are giving back a result. I also tried to query from queries and pictures from the result are below
select * from dialy;
gives:
select * from dialy; (see picture from url)
select openTime from dialy;
gives:
select openTime from dialy;
This happens only on the columns where the datatype is a bigint. Not on text or double precisions etc. Could somebody help me how to select a column with a bigint as a datatype and explain the reason behind this? tnx in advance!

Related

Can't execute select query on some columns of table in oracle [duplicate]

This question already has answers here:
View based on apex collection
(2 answers)
Can't use column names in select query on sqlfiddle (oracle)
(3 answers)
Closed 2 months ago.
I have a table with 43 columns. When I execute "Select * from My_Table", it works; And shows data of all columns.
But if I perform "Select" query on some of the columns ( In my case, the first 29 columns of the table)
I receive an error that says "INVALID IDENTIFIER".
Other columns work just fine.
I can't perform "group by" or "order by" using these 29 columns either.
What do you think is the problem?
Any help is appreciated.
Some screenshots are attached for better understanding.
Looking at screenshots, it seems that you created table using mixed letter case and enclosed column names into double quotes. If that's so, well - that's usually bad idea in Oracle as you'll always have to identify columns that way: match letter case and use double quotes.
Therefore, that would be e.g.
select "Order_Id", "Customer_name", "DATA_DATE"
from your_table
Looks awful ... will you remember that customer name doesn't have initial capital letters, but e.g. trace number does?
For you own sake, if possible, drop that table and create a new one as
create table your_table
(order_id number,
customer_name varchar2(20),
trace_number number,
...
);
and reference such a table and columns using any letter case (as it'll work because - by default - Oracle stores names in uppercase (into data dictionary), but lets you reference them any way you want):
select order_id, CUSTOMER_name, TRacE_NumBER ...

SQL not recognising table columns in ON statement [duplicate]

This question already has answers here:
Column doesnot exist error in PostgreSQL command
(1 answer)
Postgres query with uppercase letters in Column name
(1 answer)
Closed 11 months ago.
I have this SQL query:
SELECT "Segments.Id", "AggregatedValues.Segment"
FROM "Segments"
INNER JOIN "AggregatedValues" ON "Segments.Id" = "AggregatedValues.Segment";
And I get the following error:
ERROR: column "Segments.Id" does not exist
LINE 1: ... FROM "Segments" INNER JOIN "AggregatedValues" ON "Segments....
^
SQL state: 42703
Character: 99
This is EXTREMELY weird because the column DOES EXIST. The proof is that when selecting the column in the SELECT statement, no errors are thrown. It is also weird because if I change the order and say ON "AggregatedValues.Segment" = "Segments.Id" instead of ON "Segments.Id" = "AggregatedValues.Segment" then AggregatedValues.Segment appears as non existent even tho it also exists.
Any idea? I'm going mad
Thank you very much!!!!

SQL require table name in values section [duplicate]

This question already has answers here:
postgres column "X" does not exist
(1 answer)
Postgres error updating column data
(2 answers)
PostgreSQL "column "foo" does not exist" where foo is the value
(1 answer)
Closed 2 years ago.
I am trying to store the data in table by using insert query (I am using PostreSQL), but there is it.
ERROR: column "Fleet" does not exist
LINE 1: insert into appuser values("Fleet")
Postresql require column name in values section, but what is that? Why? (There is only test, my 'appuser' table has 2 columns, one of it is primary key auto-generated, so do not get confuse)
Your table has two columns and you are providing a value for only one, so you need to tell the database which one it is. Also, literal strings must be surrounded with single quotes (double quotes stand for column identifiers).
Assuming that the target column is mycol, that would be:
insert into appuser (mycol) values('Fleet')

Postgresql Column Doesn't Exist [duplicate]

This question already has answers here:
sql statement error: "column .. does not exist"
(1 answer)
PostgreSQL "Column does not exist" but it actually does
(6 answers)
ERROR: column of relation does not exist PostgreSQL ,Unable to run insert query
(3 answers)
Postgresql Column Not Found, But Shows in Describe
(1 answer)
Closed 4 years ago.
I'm running a simple select query:
SELECT return_part_i.CntrctTrmntnInd FROM return_part_i LIMIT 10;
And getting the following error:
ERROR: column return_part_i.cntrcttrmntnind does not exist LINE 1:
SELECT return_part_i.CntrctTrmntnInd FROM return_part_i LIMI...
^ HINT: Perhaps you meant to reference the column "return_part_i.CntrctTrmntnInd". SQL state: 42703 Character: 8
I have tried the query with and without the table identifier. I am copying the field name directly from the hint. This is happening with numerous fields in the database.
if you really have a camel case in you column name then you must wrap the column name with double quote
SELECT "CntrctTrmntnInd" FROM return_part_i LIMIT 10;
PostgreSQL columns (object) name are case sensitive when specified with double quotes. Unquoted identifiers are automatically used as lowercase so the correct case sequence must be write with double quotes
and as correctly suggested by Raymond Nijland if you want a LIMIT in result you should use an order by
SELECT "CntrctTrmntnInd" FROM return_part_i ORDER BY "CntrctTrmntnInd" LIMIT 10;

Why can't postgresql execute select statement whose 'where' clause has a key-matching predicate? [duplicate]

This question already has an answer here:
Strange behaviour in Postgresql
(1 answer)
Closed 6 years ago.
select * from note where noteKey = 1
This statement gives me the following error.
ERROR: column "notekey" does not exist
LINE 1: select * from note where noteKey = 1
^
HINT: Perhaps you meant to reference the column "note.noteKey".
I tried note.noteKey, but got the same error. (I used postico by the way, and the noteKey is the primary key of the table note).
What could possibly be wrong with the statement?
You need to connect with psql and run \d note.
If that shows the column is called noteKey with an uppercase K then you either have two options
Rename the column ALTER TABLE note RENAME COLUMN "noteKey" TO notekey;
Forever use double quotes " to query it.
In PostgreSQL we never quote column names. This forces them to be caps sensitive. When not quoted, they're automatically lower cased.
This
select * from note where noteKey = 1
Is the same as
select * from note where notekey = 1
Which is different from
select * from note where "noteKey" = 1