Skip to content

Tag: join

How to join queries with a subquery?

So I’m a total newbie trying to solve this exercise where I have to find all the dishes that are marked as Vegetarian but contain Turkey meat in their ingredients. This is what I’ve tried (this is where I inner join 3 tables to find the ingredients): this is where I can’t seem to be able to …

Is this a perfect SQL query to fetch random items

I have this below query to fetch books of a random author and order by the books last modified date. Because I am new to SQL something tells me this query can be improved and simplified. I would appreciate the help of the SQL experts, if this is already simplified then I will consider myself an SQL expert :).…

(SQL) Pulling linked profiles from two tables using Knex

I currently have two tables with the following data: I currently have my query set up like this with Knex: I’m currently parsing the data into the following format: This works totally fine except for the cases where the parent has no children, as it won’t pull any data at all, including parent inf…