News for hackers. Stuff that matters.
Re:EdgeDB: EdgeQL by 1st1 on Saturday July 10, 2021 @03:09PM (#27795685)
You do joins when you traverse schema type paths in EdgeQL, it's just that the actual joins are implicit (well, compared to SQL):

  SELECT User {
    email,
    preferences: {
      name,
      value
    }
  } FILTER .id = '...'
E.g. in the above example we'd join the underlying User and Preferences tables for you.

You can also do cross joins and all other funky stuff.

Re:EdgeDB: EdgeQL by AlphaSite on Saturday July 10, 2021 @04:27PM (#27796192)
How would you represent a self join?
Re:EdgeDB: EdgeQL by RedCrowbar on Saturday July 10, 2021 @04:40PM (#27796283)
If given a recursive schema like this:

    type Tree {
        property value -> str
        link parent -> Tree
    }
    
you'd traverse the link as usual:

    SELECT Tree {
        value,
        parent: {
            value
        }
    }
    FILTER .parent.parent.parent.value = 'foo'
    
If there's a need to self-join on an arbitrary property, then you could use a `WITH` clause to explicitly bind the two sets:

    WITH
        T1 := Tree,
        T2 := Tree
    SELECT
        T1 {
            similarly_valued := (SELECT T2 FILTER T1.value = T2.value)
        }
Re:EdgeDB: EdgeQL by AlphaSite on Saturday July 10, 2021 @08:43PM (#27797568)
Thanks!
Re:EdgeDB: EdgeQL by singpolyma3 on Saturday July 10, 2021 @07:42PM (#27797280)
Example from the cheatsheet:

``` WITH P := Person SELECT Person { id, full_name, same_last_name := ( SELECT P { id, full_name, } FILTER # same last name P.last_name = Person.last_name AND # not the same person P != Person ), } FILTER EXISTS .same_last_name ```