Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database error - RIGHT and FULL OUTER JOINs are not currently supported

Tags:

sql

join

sqlite

I was trying to RIGHT JOIN two tables using this query

SELECT Persons.firstname, company.lastname
FROM Persons
RIGHT JOIN company ON Persons.firstname=company.firstname;

which comes with this error-

RIGHT and FULL OUTER JOINs are not currently supported

How can we get rid of this ?

Note: I am using Mozilla DB manager.

like image 299
Amit Avatar asked Aug 08 '17 11:08

Amit


People also ask

Which database does not support full outer join?

MySQL does not support full outer join out of the box, unlike other databases such as PostgreSQL, and SQL Server. So you will need to do a full outer join using a combination of other join types such as LEFT JOIN ad RIGHT JOIN that are supported in MySQL.

Why does full outer join not work?

You're getting that error because MySQL does not support (or recognize) the FULL OUTER JOIN syntax. However, it is possible emulate a FULL OUTER JOIN in MySQL. We actually need two queries. One query return all the rows from the table on the left.

Which join is supported by SQLite * left outer join right outer join full outer join all of the above?

Unfortunately, SQLite does not support the RIGHT JOIN clause and also the FULL OUTER JOIN clause. However, you can easily emulate the FULL OUTER JOIN by using the LEFT JOIN clause.

Does SQLite support full outer join?

SQLite does not directly support the RIGHT JOIN and FULL OUTER JOIN.


2 Answers

By doing a left join and switching the tables

SELECT Persons.firstname, company.lastname
FROM company
LEFT JOIN Persons ON Persons.firstname = company.firstname;
like image 124
juergen d Avatar answered Sep 19 '22 21:09

juergen d


For FULL OUTER JOIN UNION the result of LEFT and RIGHT( again swapped LEFT JOIN) JOIN results...

 SELECT Persons.firstname,company.lastname FROM Persons LEFT JOIN company ON 
 Persons.firstname=company.firstname
 union 
 SELECT Persons.firstname, company.lastname FROM company LEFT JOIN Persons ON 
 Persons.firstname=company.firstname;
like image 37
Siddappa Walake Avatar answered Sep 19 '22 21:09

Siddappa Walake