# JuliaDB cross reference

**URL:** https://discourse.julialang.org/t/juliadb-cross-reference/20705
**Category:** Data
**Tags:** question, juliadb
**Created:** [February 12, 2019, 3:15pm UTC](https://discourse.julialang.org/t/juliadb-cross-reference/20705 "2019-02-12T15:15:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [February 12, 2019, 3:15pm UTC](https://discourse.julialang.org/t/juliadb-cross-reference/20705/1 "2019-02-12T15:15:28Z")

</div>

_Disclaimer:_ I do not know any SQL. JuliaDB seems really straightforward so I’m trying it instead of some SQLish solution (although I suspect that’s what I should be using).

I have a few tables (currently saved as `.csv` files) with primary keys and some cross references connecting them. I need to iterate over the rows of one table. Each row has a primary ID. I need to find the row that has the same (foreign) ID in a different table. Use the data in _that_ row for finding other rows in other tables etc etc etc…

I’ve found tons of (great) info on how to work with one table, but I couldn’t find (any) info on how to work with multiple tables, cross referencing, etc. I’m solving this now with tons of `findfirst`s and `isequal`s, but it seems there would be some better solution (I imagine it would have to do with the one2one, one2many, or many2many relationships?) out there.

In one way, there seems to be tons of great easy ways to access specific columns but nothing for the rows. I suspect I’ve missed something obvious since there is an API for specifying which column has the primary key, so surely there should be a way to use that information to find a row with a specific key? Like with a `Dict`?

Since I haven’t really done any rigorous database management, any light would be helpful …

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [February 12, 2019, 4:25pm UTC](https://discourse.julialang.org/t/juliadb-cross-reference/20705/2 "2019-02-12T16:25:35Z")

</div>

I think you are looking for joins:  
[http://juliadb.org/latest/joins/](http://juliadb.org/latest/joins/)

---

<div class="post-metadata">

### Author: ![aalexandersson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aalexandersson/32/2927_2.png) [@aalexandersson](https://discourse.julialang.org/u/aalexandersson)
#### Post date: [February 12, 2019, 5:01pm UTC](https://discourse.julialang.org/t/juliadb-cross-reference/20705/3 "2019-02-12T17:01:27Z")

</div>

@yakir12 Or do you want to combine the tables horizontally as in “merge”?

[https://github.com/JuliaComputing/JuliaDB.jl/issues/150](https://github.com/JuliaComputing/JuliaDB.jl/issues/150)

---

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [February 12, 2019, 8:00pm UTC](https://discourse.julialang.org/t/juliadb-cross-reference/20705/4 "2019-02-12T20:00:52Z")

</div>

> [@oheil](#):
>
> I think you are looking for joins

This seems to do the job (more or less, I need to explore some more).

> [@aalexandersson](#):
>
> Or do you want to combine the tables horizontally as in “merge”?

Not really. The tables do not share the same primary keys. But thanks!!!
