logoalt Hacker News

data_derstoday at 3:44 PM1 replyview on HN

I agree that CTEs help solve the problem of being able to read a SQL query from top to bottom, but I wouldn't say they're a panacea!

Personally, it's weird to me that `FROM` (scan) comes after `SELECT` (projection). IMHO the datasource should come first!

CTEs don't solve this problem they just let you chain multiple SELECTs together.

A real use case is that it would allow intellisense to kick in a lot earlier!

Instead you have to write `SELECT * FROM my_table` and only after can you edit the `*` and get auto-complete suggestions of the columns from `my_table`


Replies

bob1029today at 4:15 PM

> CTEs don't solve this problem

They kind of do in my head. "WITH" reads to me exactly like the datasource you are looking for.