amazon-web-servicessyntaxsql-updateamazon-redshift

Proper syntax in redshift sql for "schema"."table"."field"?


I'm updating table_A with a variable, new_var, pulled in from table_B.

Both table_A and table_B are in the same schema.

alter table schema.table_A add column new_var varchar(3)

update schema.table_A
set schema.table_A.new_var = schema.table_B.new_var 
from schema.table_B where schema.table_A.record_id = schema.table_B.record_id

However, Redshift doesn't recognize the "schema"."table"."field" syntax format.

How do you identify variables from a specific schema and table?


Solution

  • Redshift does recognize the "schema"."table"."field" syntax format. You don't have to specify the table and schema for schema.table_A.new_var It is implied that the column you are updating (new_var) is a column of schema.table_A