Re:PRQL – A proposal for a better SQL
by rswail on Tuesday January 25, 2022 @12:48AM
(#30068588)
> Can I take two queries and squash them together in a reliable way? I feel like I end up with a lot of theme and variation in my queries, often involving optional filters.
That's essentially what SQL views do. Each view is a query and then you can treat it like a table and filter/join on it.
Of course, then the problem becomes whether or not the query planner can see through the view to the underlying tables to optimize correctly.
That's essentially what SQL views do. Each view is a query and then you can treat it like a table and filter/join on it.
Of course, then the problem becomes whether or not the query planner can see through the view to the underlying tables to optimize correctly.