Hacker News new | ask | show | jobs
by richbell 831 days ago
IMO having SELECT before FROM is one of SQL's biggest mistakes. I would gladly welcome a new syntax that rectifies this. (Also https://duckdb.org/2022/05/04/friendlier-sql.html)

I don't love the multiple WHEREs.

4 comments

Duckdb also supports prql with an extension https://github.com/ywelsch/duckdb-prql
SQL was supposed to follow English grammar. Having FROM before SELECT is like having “Begun” before “these clone wars have.”
That's a great list of friendlier sql in DuckDB. For most of that list I either run into it regularly or have wanted the exact fix they have.
duckDB is what sql should be in 2024

https://duckdbsnippets.com/

The very first example on that page is vulnerable to injection.
Which one?

  #!/bin/bash 
  function csv_to_parquet() {     
      file_path="$1"     
      duckdb -c "COPY (SELECT * FROM read_csv_auto('$file_path')) TO '${file_path%.*}.parquet' (FORMAT PARQUET);" }
Eh, in the context of the site and other snippets that seems pedantic.

Could it be run on untrusted user input? Sure. Does it actually pose a threat? It's improbable.