Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon Redshift - What is the default join?

What is the default "join" in Amazon Redshift? When I do not specify any direction, does Redshift use Inner or Left or Right or Outer join?

like image 799
redwolf_cr7 Avatar asked Oct 19 '25 16:10

redwolf_cr7


2 Answers

Amazon Redshift is based on PostgreSQL which defaults on INNER JOIN same as many other query languages.

You can also find it out by creating two simple tables as following and executing a simple SELECT by JOIN query

A    B
-    -
1    3
2    4
3    5
4    6
select * from a JOIN b on a.a = b.b;

Here 1,2 are unique to table A and 5,6 are unique to table B while 3,4 being common the query above returns only the values 3,4 so it's inner join.

like image 52
Manish Batra Avatar answered Oct 22 '25 05:10

Manish Batra


Redshift, like pretty much all SQL databases, follow the SQL Standard.

It specifies that when join type is absent, it is equivalent to INNER JOIN

From the SQL Specification:

If a < qualified join > or < natural join > is specified and a < join type > is not specified, then INNER is implicit.

like image 33
Marcin Zukowski Avatar answered Oct 22 '25 05:10

Marcin Zukowski