cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Databricks database

greengil
New Contributor III

In Oracle, I create schemas and tables and link tables together via the primary/foreign key to do SQL queries.

In Databricks, I notice that I can create tables, but how do I link tables together for querying?  Does Databricks queries need the key in the table columns just like Oracle to query for data?

2 ACCEPTED SOLUTIONS

Accepted Solutions

dbxdev
New Contributor II

Databricks supports primary and foreign key constraints on Unity Catalog Delta tables, but these are informational and not enforced; queries do not depend on them to be able to join tables .
To query all related data from multiple tables you will need to use join between all the related tables with right join condition . 

View solution in original post

tharple135
New Contributor II

@greengil you treat your joins in Databricks the same way you would in any other relational database.  Join 2+ tables together using the primary/foreign keys from each of those tables.  

View solution in original post

4 REPLIES 4

dbxdev
New Contributor II

Databricks supports primary and foreign key constraints on Unity Catalog Delta tables, but these are informational and not enforced; queries do not depend on them to be able to join tables .
To query all related data from multiple tables you will need to use join between all the related tables with right join condition . 

greengil
New Contributor III

Hi @dbxdev - Thank you for your reply.  So to join the 2 tables, similar to the relational database SQLs, I will still need to specify the unique keys in each table and join the tables accordingly?  Thanks!

tharple135
New Contributor II

@greengil you treat your joins in Databricks the same way you would in any other relational database.  Join 2+ tables together using the primary/foreign keys from each of those tables.  

greengil
New Contributor III

thank you for the info!