Databricks database

greengil
Contributor

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?

pradeep_singh
Contributor III

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 . 

Thank You
Pradeep Singh - https://www.linkedin.com/in/dbxdev

View solution in original post

Hi @pradeep_singh - 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 III

@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

thank you for the info!

balajij8
Contributor III

Primary & Foreign Keys are informational unlike Oracle. You can use Unity Catalog Lineage Graph for easily finding the relationships between tables in Databricks.