help() uri = "sqlite:///tracks.db" connect(uri, load_all_tables: true) tables() tracks join(t: tracks.AlbumId, a: albums.AlbumId) table albums { ArtistId: artists.ArtistId ... } table tracks { AlbumId: albums.AlbumId, GenreId: genres.GenreId ... } join(t: tracks, art: artists, alb: albums, g: genres) tracks_joined = join(art: artists, alb: albums, t: tracks, g: genres) { ...t !GenreId !AlbumId !TrackId // Take everything from `t` except the ids Artist: art.Name Album: alb.Title Genre: g.Name } playlist_track table playlist_track { PlaylistId: playlists.PlaylistId TrackId: tracks.TrackId } join(pt: playlist_track, p: playlists) {p.PlaylistId, p.Name => count()} tracks_with_categories = join(t: tracks, pt: playlist_track, p: playlists) { ...t => Categories: p.Name }