2

Lets suppose I have two schemas in one DB: public and private. In both schemas I have the same table - my_table with the same columns. So is it normal to do the following:

SELECT public.my_table.my_col FROM public.my_table? 

I am trying to do it with H2 but get exception in ResultSet - column not found. Is it not normal or it's not normal for H2?

1
  • Try not to write what you are not required to write - that will make your code more readable in most cases. In this particular case, the DBMS will know where the column comes from even if you don't explicitly specify it, so don't explicitly specify it. Commented Jul 13, 2015 at 6:31

1 Answer 1

1

You should write:

SELECT my_col FROM public.my_table 

since column names are already evaluated in the table(s) specified in the query.

Sign up to request clarification or add additional context in comments.

Comments