Deepak Kumar
Deepak Kumar

Reputation: 3751

Can we join two tables in postgresql if the tables are in different schemas?

I have one table in public schema and a second table in deepak schema. Both the schemas are under same database.

Can I join data from these two tables?

Upvotes: 42

Views: 30947

Answers (2)

Michael Krelin - hacker
Michael Krelin - hacker

Reputation: 143061

Sure, just use their fully-qualified names public.t1 JOIN deepak.t2 USING (col).

Upvotes: 38

Brian Roach
Brian Roach

Reputation: 76888

Yes, you just prepend the schema.

public.table
deepak.table

Upvotes: 21

Related Questions