Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

In MySQL, I have two different databases -- let's call them A and B.

Is it possible to perform a join between a table that is in database A, to a table that is in database B?

1 Answer

0 votes
by (40.7k points)

If the account has appropriate permissions, then you can use the below code.

Query:

SELECT <...>

FROM A.table1 t1 JOIN B.table2 t2 ON t2.column2 = t1.column1;

Note: you've got to prefix the table reference with the name of the DB it resides in.

Related questions

0 votes
1 answer
0 votes
1 answer
+3 votes
1 answer
asked Jul 3, 2019 in SQL by Tech4ever (20.3k points)
+3 votes
1 answer
asked Jul 3, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...