Question : I apologize if this is the wrong place to ask, but I really need some opinion on whether […]
Category: Join
Build JSON object from one-to-many relationship data in a single query?
Question : I have a PostgreSQL 9.5.3 DB with tables like this: container id: uuid (pk) … other data thing […]
Expressing some queries without employing JOIN or OUTER JOIN
Question : Assume the following relations schemas: S(A,B) T(B,C) Rewrite the following expressions without using join or outer join operators […]
sort results by highest performing country & region
Question : I want to check which country & regions are performing the best in sales. I have the following […]
Merge output of two Queries MYSQL
Question : I have a mysql table with the following schema: +————+————-+——+—–+———+——-+ | Field | Type | Null | Key […]
Optimize a slow nested loops join
Question : I have this query running around 15 seconds on my system. The query plan is here. I believe […]
How can I identify correlated subqueries that can not be rewritten as JOINs without using DISTINCT?
Question : I am fairly new to SQL query tuning. I have been trying to understand how to write equivalent […]
Generate multiple running totals with GROUP BY day
Question : I have a set of transactions of stock purchases by users and I want to keep track of […]
Select rows with repeat data within certain timeframe
Question : As a follow-up question to my previous question on difficult row categorisation, I have another problem which I’m […]
How can I Rewrite Update Query to Update Using First Record From Inner Join?
Question : I wrote up a question about trying to do an update with an inner join last week that […]