News for hackers. Stuff that matters.
Re:Pipe Syntax in SQL by richbell on Saturday August 24, 2024 @12:30PM (#41339361)
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.

Re:Pipe Syntax in SQL by abelcha on Saturday August 24, 2024 @04:07PM (#41341094)
duckDB is what sql should be in 2024

https://duckdbsnippets.com/

Re:Pipe Syntax in SQL by xigoi on Sunday August 25, 2024 @05:31AM (#41345889)
The very first example on that page is vulnerable to injection.
Re:Pipe Syntax in SQL by richbell on Sunday August 25, 2024 @12:11PM (#41348414)
Which one?
Re:Pipe Syntax in SQL by xigoi on Sunday August 25, 2024 @12:24PM (#41348548)

  #!/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);" }
Re:Pipe Syntax in SQL by richbell on Sunday August 25, 2024 @09:59PM (#41353333)
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.

Re:Pipe Syntax in SQL by viraptor on Saturday August 24, 2024 @08:10PM (#41343054)
Duckdb also supports prql with an extension https://github.com/ywelsch/duckdb-prql
Re:Pipe Syntax in SQL by RaftPeople on Sunday August 25, 2024 @11:37AM (#41348054)
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.
Re:Pipe Syntax in SQL by mr_toad on Thursday August 29, 2024 @12:33AM (#41387338)
SQL was supposed to follow English grammar. Having FROM before SELECT is like having “Begun” before “these clone wars have.”