r/SQL • • Oct 18 '24

BigQuery Revolutionizing SQL with pipe syntax

https://cloud.google.com/blog/products/data-analytics/simplify-your-sql-with-pipe-syntax-in-bigquery-and-cloud-logging
0 Upvotes

13 comments sorted by

View all comments

14

u/VladDBA SQL Server DBA Oct 18 '24

Oh, look, it's this nonsense again.

Counterpoint: revolutionize SQL by actually learning it.

4

u/nottalkinboutbutter Oct 18 '24

Or actually standardizing it. I'm currently trying to move from Oracle to PostgreSQL which is a relatively small move, but it's so frustrating that a supposedly standardized language like SQL has so many differences. I currently have to work with 4 different SQL flavors which are mostly the same, but where each has some small but significant differences which change the whole way I need to structure a query. You can learn 95% of SQL, but 5% of it is learning the unique differences across the different versions that implement things so differently that it's way more than 5% effort to change. This "pipe syntax" does nothing but add one more variation. And it's Google, so I don't trust them to support this for more than a few years before discontinuing it.

1

u/kevinpostlewaite Oct 21 '24

I have not tried it myself but you may find the Python lib sqlglot useful.

0

u/slowpush Oct 18 '24

Most of SQL’s mannerisms are unnecessary.

Group BY a, b, c, d

Vs

GROUP BY ALL

Select * from a

Vs

FROM a

Pipes just eliminate a whole bunch of boilerplates and syntax dressing that’s largely useless.

3

u/[deleted] Oct 18 '24

Group BY a, b, c, d

Vs

GROUP BY ALL

GROUP BY ALL would essentially be a different way of writing a SELECT DISTINCT

Select * from a

Vs

FROM a

The SQL standard allows table a as a replacement for select * from a

0

u/slowpush Oct 18 '24

GROUP BY ALL would essentially be a different way of writing a SELECT DISTINCT

Distinct removes duplicates Group BY ALL groups the content so that you can do aggregations.

3

u/[deleted] Oct 19 '24

If you want to group by "all columns" there is no difference between:

 select distinct a,b,c,d
 from t

and

 select  a,b,c,d
 from t
 group by a,b,c,d

2

u/TreeOaf Oct 18 '24

Whilst it does seem that this would be at the expense of readability, it would be great for dynamic sql / application executions, as you would be able to write much more concise statements.